下面代码执行到RIGHT字段的时候有上述提示,为什么啊?还有就是API函数在哪里定义
Private Sub Form_Resize()
On Error Resume Next
Label2.Top = 5
Label2.Left = 15
leftup.Top = 15
leftup.Left = 0
uppe.Top = 0
uppe.Left = 15
uppe.Width = Me.ScaleWidth - 30
rightup.Left = Me.ScaleWidth - 15
rightup.Top = 0
Right.Left = Me.ScaleWidth - 15
Right.Top = 15
Right.Height = Me.ScaleHeight - 30
rightdown.Left = Me.ScaleHeight - 15
down.Top = Me.ScaleHeight - 15
down.Left = 15
down.Width = Me.scalwidth - 30
leftdown.Left = 0
leftdown.Top = Me.ScaleHeight - 15
leftpic.Left = 0
leftpic.Top = 15
leftpic.Height = Me.ScaleHeight - 30
shapetheform MeEnd SubPrivate Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
releasecapture
SendMessage Me.hwnd, &H112, &H12, 0End SubPrivate Sub Label2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
releasecapture
SendMessage Me.hwnd, &H112, &H12, 0
End Sub
Sub shapetheform(theform As Form)
With theform
If Form1.Width < 4200 Then
Form1.Width = 4200
Exit Sub
End If
If Form1.Height < 3000 Then
Form1.Height = 3000
Exit Sub
End If
thematrix = CreateRecRgn(0, 0, .ScaleWidth, .ScaleHeight)
notthematrix = CreateRecRgn(0, 0, .ScaleWidth, .ScaleHeight)
a = CreateRectRgn(10, 0, .ScaleWidth, .ScaleHeight)
b = CreateRectRgn(0, 10, .ScaleWidth, .ScaleHeight - 10)
c = CreateRectRgn(0, 0, 20, 20)
d = CreateRectRgn(0, .ScaleHeight, 20, .ScaleHeight - 20)
e = CreateRectRgn(.ScaleWidth, 0, .ScaleWidth - 20, 20)
f = CreateRectRgn(.ScaleWidth, .ScaleHeight, .ScaleWidth - 20, .ScaleHeight - 20)
g = CombineRgn(thematrix, thematrix, a, 4)
g = CombineRgn(thematrix, thematrix, b, 4)
g = CombineRgn(thematrix, thematrix, c, 4)
g = CombineRgn(thematrix, thematrix, d, 4)
g = CombineRgn(thematrix, thematrix, e, 4)
g = CombineRgn(thematrix, themtrix, f, 4)
g = CombineRgn(thematrix, notthematrix, thematrix, 4)
m = setwidowrgn(.hwnd, thematrix, True)
DeleteObject thematrix
DeleteObject notthematrix
DeleteObject a
DeleteObject b
DeleteObject c
DeleteObject d
DeleteObject e
DeleteObject f
DeleteObject g
DeleteObject m
End With
End Sub

解决方案 »

  1.   

    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 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 SetWindowRgn Lib "user32" (ByVal hWnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long
    Private Sub Form_Resize()
    On Error Resume Next
    Label2.Top = 5
    Label2.Left = 15
    leftup.Top = 15
    leftup.Left = 0
    uppe.Top = 0
    uppe.Left = 15
    uppe.Width = Me.ScaleWidth - 30
    rightup.Left = Me.ScaleWidth - 15
    rightup.Top = 0
    Right.Left = Me.ScaleWidth - 15
    Right.Top = 15
    Right.Height = Me.ScaleHeight - 30
    rightdown.Left = Me.ScaleHeight - 15
    down.Top = Me.ScaleHeight - 15
    down.Left = 15
    down.Width = Me.scalwidth - 30
    leftdown.Left = 0
    leftdown.Top = Me.ScaleHeight - 15
    leftpic.Left = 0
    leftpic.Top = 15
    leftpic.Height = Me.ScaleHeight - 30
    shapetheform MeEnd SubPrivate Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ReleaseCapture
    SendMessage Me.hWnd, &H112, &H12, 0End SubPrivate Sub Label2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    ReleaseCapture
    SendMessage Me.hWnd, &H112, &H12, 0
    End Sub
    Sub shapetheform(theform As Form)
    With theform
    If Form1.Width < 4200 Then
    Form1.Width = 4200
    Exit Sub
    End If
    If Form1.Height < 3000 Then
    Form1.Height = 3000
    Exit Sub
    End If
    thematrix = CreateRecRgn(0, 0, .ScaleWidth, .ScaleHeight)
    notthematrix = CreateRecRgn(0, 0, .ScaleWidth, .ScaleHeight)
    a = CreateRectRgn(10, 0, .ScaleWidth, .ScaleHeight)
    b = CreateRectRgn(0, 10, .ScaleWidth, .ScaleHeight - 10)
    c = CreateRectRgn(0, 0, 20, 20)
    d = CreateRectRgn(0, .ScaleHeight, 20, .ScaleHeight - 20)
    e = CreateRectRgn(.ScaleWidth, 0, .ScaleWidth - 20, 20)
    f = CreateRectRgn(.ScaleWidth, .ScaleHeight, .ScaleWidth - 20, .ScaleHeight - 20)
    g = CombineRgn(thematrix, thematrix, a, 4)
    g = CombineRgn(thematrix, thematrix, b, 4)
    g = CombineRgn(thematrix, thematrix, c, 4)
    g = CombineRgn(thematrix, thematrix, d, 4)
    g = CombineRgn(thematrix, thematrix, e, 4)
    g = CombineRgn(thematrix, themtrix, f, 4)
    g = CombineRgn(thematrix, notthematrix, thematrix, 4)
    m = setwidowrgn(.hWnd, thematrix, True)
    DeleteObject thematrix
    DeleteObject notthematrix
    DeleteObject a
    DeleteObject b
    DeleteObject c
    DeleteObject d
    DeleteObject e
    DeleteObject f
    DeleteObject g
    DeleteObject m
    End With
    End Sub
      

  2.   

    不知道你的right,left,down 等是什么控件
      

  3.   

    就是窗体的左右,和下面,API函数在哪里定义啊
      

  4.   

    将Right这个控件名称改一下.改为 Right1
      

  5.   

    用到的API 一定要定义好,可以在模块中用public来定义,也可以在窗口中用private来定义.
      

  6.   

    请搜索win32api.txt,这里里面是定义api的