1.在Global External Function中申明外部函数
//透明窗体设置
Function ulong SetLayeredWindowAttributes(ulong hWnd , long crKey , Character bAlpha ,long dwFlags) library"user32.dll" alias for "SetLayeredWindowAttributes;Ansi"
FUNCTION ulong SetWindowulong(ulong hwnd,ulong nIndex,ulong dwNewLong) LIBRARY "user32.dll" ALIAS FOR "SetWindowLongA"
2.在instance variables中声明变量
//半透明窗口设置
ulong GWL_WNDPROC = -4
ulong GWL_HINSTANCE = -6
ulong GWL_STYLE = -16
ulong GWL_EXSTYLE = -20
ulong GWL_USERDATA = -21
ulong GWL_ID = -12
ulong DWL_MSGRESULT = 0
ulong DWL_DLGPROC = 4
ulong DWL_USER = 8
ulong WS_EX_LAYERED = 524288
long LWA_COLORKEY = 1
long LWA_ALPHA = 2
3.在窗口的open事件中添加如下代码
//设置窗口新的扩展属性
SetWindowulong(Handle(This), GWL_EXSTYLE, WS_EX_LAYERED)
//设置透明度
SetLayeredWindowAttributes(Handle(This), 0, Char(200), LWA_ALPHA)
.