//聲明:
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;
//效果圖: