谁来帮帮忙
[此贴子已经被作者于2007-1-2 23:23:22编辑过]
'窗体代码如下。窗体中添加两个PictureBox控件一个command控件
Private Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long
Private Declare Function SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw 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 Sub Command1_Click()
Dim RgnLong As Long
If Command1.Caption = "取消马的边框" Then
SetRGN Picture1.hWnd
Command1.Caption = "显示马的边框"
Else
RgnLong = CreateRectRgn(1, 1, 94, 94) '这里的94分别是Picture1.ScaleWidth +4 和 Picture1.ScaleHeight+4
If RgnLong Then SetWindowRgn Picture1.hWnd, RgnLong, True
Command1.Caption = "取消马的边框"
End If
End Sub
Private Sub Form_Load()
Command1.Caption = "取消马的边框"
SetRGN (Picture2.hWnd)
End Sub
Private Function SetRGN(ByVal hWnd As Long)
Dim RgnLong As Long
RgnLong = CreateRoundRectRgn(1, 1, 94, 94, 94, 94) '这里的94分别是Picture1.ScaleWidth +4 和 Picture1.ScaleHeight+4
If RgnLong Then SetRGN = SetWindowRgn(hWnd, RgnLong, True)
End Function
'附上工程源码
[此贴子已经被作者于2007-1-3 10:44:46编辑过]