好象不会啊! procedure TForm1.Button1Click(Sender: TObject); var I: integer; begin Canvas.Brush.Color := clBlue; Canvas.FillRect(Rect(0,0,Width,Height)); I := Canvas.Pixels[10,10]; ShowMessage(inttostr(i)); end;
在程序里仍然是-1,但是你把inttostr的时候会做字节变动,所以看不出来, 看到帮助里,有写Read Pixels to learn the color on the drawing surface at a specific pixel position within the current clipping region. If the position is outside the clipping rectangle, reading the value of Pixels returns -1. 和Not every device context supports the Pixels property. Reading the Pixels property for such a device context will return a value of -1. Setting the Pixels property for such a device context does nothing. 也指定了这个clipping region,但是好像效果不佳
IntToStr(-1)应该就是"-1"吧 procedure TForm1.Button1Click(Sender: TObject); var I: integer; begin Canvas.Brush.Color := clBlue; //我这里设为clRed和clBlue显示的值是不一样的! Canvas.FillRect(Rect(0,0,Width,Height)); I := Canvas.Pixels[10,10]; ShowMessage(inttostr(i)); end;
ead Pixels to learn the color on the drawing surface at a specific pixel position within the current clipping region我想问题就在这里吧: 'current clipping region' 我们设断点的时候已经是跳到了DELPHI的编辑器来了!
procedure TForm1.Button1Click(Sender: TObject);
var
I: integer;
begin
Canvas.Brush.Color := clBlue;
Canvas.FillRect(Rect(0,0,Width,Height));
I := Canvas.Pixels[10,10];
ShowMessage(inttostr(i));
end;
看到帮助里,有写Read Pixels to learn the color on the drawing surface at a specific pixel position within the current clipping region. If the position is outside the clipping rectangle, reading the value of Pixels returns -1.
和Not every device context supports the Pixels property. Reading the Pixels property for such a device context will return a value of -1. Setting the Pixels property for such a device context does nothing.
也指定了这个clipping region,但是好像效果不佳
procedure TForm1.Button1Click(Sender: TObject);
var
I: integer;
begin
Canvas.Brush.Color := clBlue; //我这里设为clRed和clBlue显示的值是不一样的!
Canvas.FillRect(Rect(0,0,Width,Height));
I := Canvas.Pixels[10,10];
ShowMessage(inttostr(i));
end;
我们设断点的时候已经是跳到了DELPHI的编辑器来了!
if Canvas.Pixels[10,10] = clred then
begin
//1
end
else
begin
//2
end;
单步跟踪的时候不跳到1中,但是实际上执行程序的时候是经过了1的。