非常感謝在Form
創建Label
控制,並使用類似以下內容,使其透明:
Me.TransparencyKey = Color.Gray ' or any other color.
Me.BackColor = TransparencyKey
Me.FormBorderStyle = FormBorderStyle.None
會讓這樣的事情:
爲了讓你的窗口透明的鼠標,PInvoke的GetWindowLong
和SetWindowLong
:
<DllImport("user32.dll", SetLastError:=True)> _
Private Shared Function GetWindowLong(_
ByVal hWnd As IntPtr, _
ByVal nIndex As Integer) As Integer
End Function
<DllImport("user32.dll")> _
Private Shared Function SetWindowLong(_
ByVal hWnd As IntPtr, _
ByVal nIndex As Integer, _
ByVal dwNewLong As IntPtr) As Integer
End Function
在
Form_Load()
添加以下
然後:
Dim hwnd As IntPtr = Me.Handle
Dim extendedStyle As Integer = GetWindowLong(hwnd, GWL_EXSTYLE)
SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle Or WS_EX_TRANSPARENT)
常量:
Const WS_EX_TRANSPARENT As Integer = &H20
Const GWL_EXSTYLE As Integer = -20
威爾說允許用戶移動「在」表單下的應用程序?或者表單會採取積極的焦點? – JordanW
啓用Aero後,移動窗體下的窗口將不起作用。 –