怎样把一个TBitmap画到(覆盖)另一个TBitmap上?(100分)

  • 主题发起人 一个过客
  • 开始时间

一个过客

Unregistered / Unconfirmed
GUEST, unregistred user!
并且把上面的TBitmap抠一个圆形的窟窿,窟窿里面露出下面的TBitmap?

换句话说,如何在一个TBitmap上画一个透明的窟窿,露出下面的东西?
再换句话说,怎样画TBitmap的时候,透明它上面的某一个圆形区域?
 
推荐几个函数给你用,SetWindowRgn(HWND hwnd,HRGN hRgn,BOOL bRedraw),GetWindowRgn(HWND hwnd,HRGN hRgn)
应该能达到你要的效果
 
老弟,这里没有Window,只有Bitmap啊
 
把透明区域画成一种不用的颜色
把 TBitMap 里的
Transparent := true
TransparentMode := tmFixed;
TransparentColor 设成该颜色

如果图像的左下角的颜色就是透明色,那么可以
TransparentMode := tmAuto; 自动,不用设 TransparentColor


procedure TForm1.Button1Click(Sender: TObject);

var
Bitmap : TBitMap;
begin
Bitmap := TBitmap.Create;
try
with Bitmap do begin
LoadFromFile('MyBitmap.png');
Transparent := True;
TransParentColor := BitMap.Canvas.Brush.Color;
Form1.Canvas.Draw(0,0,BitMap);
TransparentMode := tmAuto;
Form1.Canvas.Draw(50,50,BitMap);
end;
finally
Bitmap.Free;
end;
end;
 
到底要做什么啊。做界面?有现成的来着。
 
接受答案了.
 
顶部