如何创建透明窗体?
{?在窗體中添加?button,然后加入以下代碼:}?
procedure?TForm1.FormCreate(Sender:?TObject);?
var?
??FullRgn,?ClientRgn,?ButtonRgn:?THandle;?
??Margin,?X,?Y:?Integer;?
begin?
??Margin?:=?(Width?-?ClientWidth)?div?2;?
??FullRgn?:=?CreateRectRgn(0,?0,?Width,?Height);?
??X?:=?Margin;?
??Y?:=?Height?-?ClientHeight?-?Margin;?
??ClientRgn?:=?CreateRectRgn(X,?Y,?X?+?ClientWidth,?Y?+?ClientHeight);?
??CombineRgn(FullRgn,?FullRgn,?ClientRgn,?RGN_DIFF);?
??X?:=?X?+?Button1.Left;?
??Y?:=?Y?+?Button1.Top;?
??ButtonRgn?:=?CreateRectRgn(X,?Y,?X?+?Button1.Width,?Y?+?Button1.Height);?
??CombineRgn(FullRgn,?FullRgn,?ButtonRgn,?RGN_OR);?
??SetWindowRgn(Handle,?FullRgn,?True);?
end;
procedure?TForm1.FormCreate(Sender:?TObject);?
var?
??FullRgn,?ClientRgn,?ButtonRgn:?THandle;?
??Margin,?X,?Y:?Integer;?
begin?
??Margin?:=?(Width?-?ClientWidth)?div?2;?
??FullRgn?:=?CreateRectRgn(0,?0,?Width,?Height);?
??X?:=?Margin;?
??Y?:=?Height?-?ClientHeight?-?Margin;?
??ClientRgn?:=?CreateRectRgn(X,?Y,?X?+?ClientWidth,?Y?+?ClientHeight);?
??CombineRgn(FullRgn,?FullRgn,?ClientRgn,?RGN_DIFF);?
??X?:=?X?+?Button1.Left;?
??Y?:=?Y?+?Button1.Top;?
??ButtonRgn?:=?CreateRectRgn(X,?Y,?X?+?Button1.Width,?Y?+?Button1.Height);?
??CombineRgn(FullRgn,?FullRgn,?ButtonRgn,?RGN_OR);?
??SetWindowRgn(Handle,?FullRgn,?True);?
end;
轉載于:https://www.cnblogs.com/myamanda/articles/1539389.html
總結
- 上一篇: NHibernate教程2(转载)
- 下一篇: 产品经理讲座的感悟