void CDDALineView::dda(CPoint ptStart, CPoint ptEnd, CDC* pDC) { float x, y, xincre, yincre; int k = abs(ptEnd.x - ptStart.x); if (abs(ptEnd.y - ptStart.y) > k) { k = abs(ptEnd.y - ptStart.y); } xincre = (float)(ptEnd.x - ptStart.x)/k; yincre = (float)(ptEnd.y - ptStart.y)/k; x = ptStart.x; y = ptStart.y; for (int i = 1; i < k; i++) { pDC->SetPixel(x, y, RGB(255, 0, 0)); x = x + xincre; y = y + yincre; } }