//声明: SetPixel( DC: HDC; {设备环境句柄} X, Y: Integer; {坐标} Color: COLORREF {颜色值} ): COLORREF; {返回颜色值} SetPixelV( DC: HDC; {设备环境句柄} X, Y: Integer; {坐标} Color: COLORREF {颜色值} ): BOOL; {SetPixel 与 SetPixelV 功能一致, 但返回值不一样; 书上说 SetPixelV 更快.}
//举例: procedure TForm1.FormPaint(Sender: TObject); var c: TColor; x,y: Integer; begin Self.Color := clWhite; c := clRed; x := 1; y := 1; while x < ClientWidth do begin while y < ClientHeight do begin SetPixel(Canvas.Handle, x, y, c); Inc(y,4); end; Inc(x,4); y := 0; end; end;
//效果图: