VB使用Image放一个圆,如何
可以使用透明窗体来解决这个问题,
1。窗体置前
2。窗体透明,控件不透明;
Option Explicit
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Lo...全部
可以使用透明窗体来解决这个问题,
1。窗体置前
2。窗体透明,控件不透明;
Option Explicit
Private Const SWP_NOSIZE = &H1
Private Const SWP_NOMOVE = &H2
Private Const HWND_TOPMOST = -1
Private Const HWND_NOTOPMOST = -2
Private Declare Function SetWindowPos Lib "user32" (ByVal hwnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long) As Long
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Private Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
Const WS_EX_LAYERED = &H80000
Const GWL_EXSTYLE = (-20)
Const LWA_ALPHA = &H2
Const LWA_COLORKEY = &H1
Dim iMType As Integer
Public Sub ShowMe(iProType As Integer)
iMType = iProType
Me。
Show
End Sub
Private Sub Form_Load()
Dim rtn As Long
If iMType = 0 Then
imgBk(0)。
Visible = True
Else
imgBk(1)。Visible = True
End If
SetWindowPos hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE
Me。
BackColor = RGB(20, 20, 20)
rtn = GetWindowLong(Me。hwnd, GWL_EXSTYLE)
rtn = rtn Or WS_EX_LAYERED
SetWindowLong Me。
hwnd, GWL_EXSTYLE, rtn
SetLayeredWindowAttributes Me。hwnd, RGB(20, 20, 20), 100, LWA_COLORKEY
End Sub
Private Sub Form_Resize()
On Error Resume Next
Me。
Move Screen。Width / 2 - 210, Screen。Height / 2 - 210, 420, 420
imgBk(0)。Move 0, 0
imgBk(1)。
Move 0, 0
End Sub
。收起