Y
yaoyaoyan78
Unregistered / Unconfirmed
GUEST, unregistred user!
1.为什么我这段代码不能在image1上面显示图象;
procedure TForm1.Button1Click(Sender: TObject);
var
sourcedc,DestDC:hdc;
Bhandle:Thandle;
bitmap:Tbitmap;
begin
SourceDC:=getdc(0);
DestDC:=CreateCompatibleDC(SourceDC);
Bhandle:=CreateCompatibleBitmap(SourceDC,200,200);
SelectObject(DestDC,Bhandle);
BitBlt(DestDC,0,0,200,200,SourceDC,
0,0,SRCCOPY);
bitmap:=TBitmap.Create;
bitmap.PixelFormat:=pf24bit;
Bitmap.Handle:=BHandle;
image1.Picture.Bitmap.Height:=200;
image1.Picture.Bitmap.Width:=200;
image1.Picture.Bitmap.Assign(bitmap);
end;
2.为什么 我用bitmap.canvas.pixels[]取它的rgb值,每次得到的都是-1;
盼高手指点
procedure TForm1.Button1Click(Sender: TObject);
var
sourcedc,DestDC:hdc;
Bhandle:Thandle;
bitmap:Tbitmap;
begin
SourceDC:=getdc(0);
DestDC:=CreateCompatibleDC(SourceDC);
Bhandle:=CreateCompatibleBitmap(SourceDC,200,200);
SelectObject(DestDC,Bhandle);
BitBlt(DestDC,0,0,200,200,SourceDC,
0,0,SRCCOPY);
bitmap:=TBitmap.Create;
bitmap.PixelFormat:=pf24bit;
Bitmap.Handle:=BHandle;
image1.Picture.Bitmap.Height:=200;
image1.Picture.Bitmap.Width:=200;
image1.Picture.Bitmap.Assign(bitmap);
end;
2.为什么 我用bitmap.canvas.pixels[]取它的rgb值,每次得到的都是-1;
盼高手指点