求用c#编写的图形学的DDA画线的算法
不知道用c#怎么写,请教高手啊
void CDDALineView::OnDraw(CDC* pDC)
{
CDDALineDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
int x,x0(200),y0(200),x1(500),y1(500);
float dx,dy,y,k;
dx=x1-x0;
dy=y1-y0;
k=dy/dx;
y=y0;
for(x=x0;x<=x1;x++)
{
pDC->SetPixel(x,(int)(y+0.5),RGB(255,0,0));
y+=k;
}
}
把这个C的修改下就OK了吧~