可以的
下面的代码是制作透明窗体的。事件一样的用。Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function GetPixel Lib "gdi32" (ByVal hDC As Long, ByVal X As Long, ByVal Y As Long) As Long
Private Declare Function CreateRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As Long
Private Declare Function CombineRgn Lib "gdi32" (ByVal hDestRgn As Long, ByVal hSrcRgn1 As Long, ByVal hSrcRgn2 As Long, ByVal nCombineMode As Long) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Private Declare Function ReleaseCapture Lib "user32" () As LongPrivate Const RGN_OR = 2
Private Const WM_NCLBUTTONDOWN = &HA1
Private Const HTCAPTION = 2Private Sub Form_Load()
    Me.Width = Picture1.Width
    Me.Height = Picture1.Height
 Form2.Show
 
    WindowRegion = MWIN(Picture1)
    SetWindowRgn Me.hWnd, WindowRegion, True
End Sub
Private Function MWIN(pic As PictureBox) As Long
Dim X As Long, Y As Long, beginline As Long, a As Long, b As Long, color As Long, first As Boolean, InLine As Boolean, hDC As Long
Dim PicWidth As Long
Dim PicHeight As Long
Dim al As Long
Dim cp As LonghDC = pic.hDC
PicWidth = pic.ScaleWidth
PicHeight = pic.ScaleHeight
first = 1
InLine = 0
X = 0
Y = 0
beginline = 0
color = GetPixel(hDC, 0, 0)
For Y = 0 To PicHeight - 1
For X = 0 To PicWidth - 1
If GetPixel(hDC, X, Y) = color Or X = PicWidth Then
If InLine Then
InLine = False
b = CreateRectRgn(beginline, Y, X, Y + 1)
If first Then
a = b
first = False
Else
CombineRgn a, a, b, RGN_OR
DeleteObject b
End If
End If
Else
If Not InLine Then
InLine = True
beginline = X
End If
End If
Next X
Next Y
MWIN = a
End Function
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = vbLeftButton Then
      ReleaseCapture
      SendMessage Me.hWnd, WM_NCLBUTTONDOWN, HTCAPTION, 0&
End If
End Sub

解决方案 »

  1.   

    用制作透明窗体的方法制作的窗体可以响应的阿Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex 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 SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long
    Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As LongConst WS_EX_LAYERED = &H80000
    Const GWL_EXSTYLE = (-20)
    Const LWA_ALPHA = &H2Dim rtn As Long, numPrivate Sub Form_Load()
        Form1.Visible = False
        Form1.Timer1.Enabled = True
        Form1.AutoRedraw = True
    End SubPrivate Sub Timer1_Timer()
        If num < 251 Then
            If num > 0 Then Form1.Visible = True
            
            num = num + 5
            rtn = GetWindowLong(hwnd, GWL_EXSTYLE)
            rtn = rtn Or WS_EX_LAYERED
            SetWindowLong hwnd, GWL_EXSTYLE, rtn
            
            SetLayeredWindowAttributes hwnd, 0, num, LWA_ALPHA
        Else
           Timer1.Enabled = False
        End If
    End Sub