能不能在canvas上直接画?这样我好像有源代码,是bcb的,不只对你有没有帮助
(画坐标和正弦曲线)
Canvas->MoveTo(ox,oylen+oy);
Canvas->LineTo(ox,oy-oylen);
Canvas->MoveTo(ox,oy);
Canvas->LineTo(ox+oxlen,oy);
Canvas->MoveTo(ox,oy-oylen);
Canvas->LineTo(ox+3,oy-oylen+5);
Canvas->MoveTo(ox,oy-oylen);
Canvas->LineTo(ox-3,oy-oylen+5);
Canvas->MoveTo(ox+oxlen,oy);
Canvas->LineTo(ox+oxlen-5,oy+3);
Canvas->MoveTo(ox+oxlen,oy);
Canvas->LineTo(ox+oxlen-5,oy-3);
static int i,j,i0,j0;
for(i=ox;i<ox+oxlen;i++)
{
if(i%lensize==0)
{
if(i%(2*lensize)==0)
{
Canvas->MoveTo(i,oy);
Canvas->LineTo(i,oy+3);
}
else
{
Canvas->MoveTo(i,oy);
Canvas->LineTo(i,oy+5);
}
}
}
for(i=oylen+oy;i>oy-oylen;i--)
{
if(i%lensize==0)
{
if(i%(2*lensize)==0)
{
Canvas->MoveTo(ox,i);
Canvas->LineTo(ox-5,i);
}
else
{
Canvas->MoveTo(ox,i);
Canvas->LineTo(ox-3,i);
}
}
}
static float x,y,dx,dy;
dx=2.0*3.1416/(8*lensize);
dy=1.0/(8*lensize);
i0=ox;
j0=oy;
for(i=ox;i<ox+oxlen;i++)
{
x=(i-ox)*dx;
y=sin(x);
j=int(y/dy+0.5);
Canvas->MoveTo(i0,j0);
Canvas->LineTo(i,oy-j);
i0=i;
j0=oy-j;
}