S
szchengyu
Unregistered / Unconfirmed
GUEST, unregistred user!
如何让设置的剪切区域对以后的画图操作都有效
以下这段代码里把 SelectClipRgn 和 BitBlt 分开在两个按钮的事件里就没有效果
这是为什么?
var
rgn: HRGN;
bmp: TBitmap;
procedure TForm1.FormCreate(Sender: TObject);
begin
bmp := TBitmap.Create;
bmp.LoadFromFile('d:/2.bmp');
rgn := CreateEllipticRgn(0, 0, bmp.Width, bmp.Height);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
bmp.Free;
DeleteObject(rgn);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SelectClipRgn(Canvas.Handle, rgn);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
bitblt(Canvas.Handle, 0, 0, bmp.Width, bmp.Height,
bmp.Canvas.Handle, 0, 0, SRCCOPY);
end;
以下这段代码里把 SelectClipRgn 和 BitBlt 分开在两个按钮的事件里就没有效果
这是为什么?
var
rgn: HRGN;
bmp: TBitmap;
procedure TForm1.FormCreate(Sender: TObject);
begin
bmp := TBitmap.Create;
bmp.LoadFromFile('d:/2.bmp');
rgn := CreateEllipticRgn(0, 0, bmp.Width, bmp.Height);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
bmp.Free;
DeleteObject(rgn);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SelectClipRgn(Canvas.Handle, rgn);
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
bitblt(Canvas.Handle, 0, 0, bmp.Width, bmp.Height,
bmp.Canvas.Handle, 0, 0, SRCCOPY);
end;