delphi 窗体全透明,但窗体上的控件不透明

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/paulfzm/article/details/84411379
//窗体全透明,但窗体上的控件不透明
procedure TForm1.Button1Click(Sender: TObject);
 Var
   frmRegion, tempRegion: HRGN;
   i: Integer;
   Arect: TRect;
 Begin
   frmRegion := 0;
   For I:= 0 To ControlCount - 1 Do Begin
     aRect := Controls[i].BoundsRect;
     OffsetRect( aRect, clientorigin.x - left, clientorigin.y - top );
     tempRegion := CreateRectRgnIndirect( aRect );
     If frmRegion = 0 Then
       frmRegion := tempRegion
     Else Begin
       CombineRgn( frmRegion, frmRegion, tempRegion, RGN_OR );
       DeleteObject( tempRegion );
     End;
   End;
   tempregion :=
     CreateRectRgn( 0, 0, Width,
                    GetSystemMetrics( SM_CYCAPTION )+
                    GetSystemMetrics( SM_CYSIZEFRAME )+
                    GetSystemMetrics( SM_CYMENU ) * Ord(Menu <> Nil));
 
   CombineRgn( frmRegion, frmRegion, tempRegion, RGN_OR );
   DeleteObject( tempRegion );
   SetWindowRgn( handle, frmRegion, true );
 End;
 
展开阅读全文

没有更多推荐了,返回首页