asdf1001 兄的想法很好! 但不足之处是代码通用性不强,不能对不同大小的窗体都起到去除窗体边框的作用。
我也做了一个示例,好像通用性会强些,请大家指正错误,谢谢!
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) 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 SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
Private Sub UserForm_Click()
Unload Me
End Sub
Private Sub UserForm_Initialize()
Dim hWnd As Long, new_rgn As Long
If Val(Application.Version) < 9 Then
hWnd = FindWindow("ThunderXFrame", Me.Caption) '获取窗口句柄
Else
hWnd = FindWindow("ThunderDFrame", Me.Caption) '获取窗口句柄
End If
new_rgn = CreateRectRgn(3, 29, (Me.Width * 1.33) - 2, (Me.Height * 1.33) - 2)
SetWindowRgn hWnd, new_rgn, True
Call DeleteObject(new_rgn)
End Sub
PwiE2EEm.rar
(77.59 KB, 下载次数: 364)
|