你所说的这个功能我做过我是做成了
不过我看你的程序很难看懂    不知道你的那些
变量都是什么?
你能不能再说清楚一点?

解决方案 »

  1.   

    phy(beatrice) :
    我是在一个窗体中放了两个frame,现在想将两个frame以外的地方全部删除。现在我也做成了,不过还有些问题。
    Private Sub Form_Resize()
        Me.Move Screen.Width - Me.Width, Screen.Height - Me.Height  ', Pic.Width + 100, Pic.Height + 300
        Label1.Move 150, 150, Frame1.Width - 300, Frame1.Height - 300
        Pic.Move 0, 0, Frame2.Width, Frame2.Height
        '=================使frame1和frame2成为圆角矩形并使窗体除frame1和frame2外的区域清除======
        Dim Dl As Long, i As Integer
        Dim MeWidth As Long, MeHeight As Long, MeTop As Long, MeLeft As Long
        Dim MyRet(2) As Long, MyCombineRgn(2) As Long
        '-------------frame1成为圆角矩形
        MeWidth = (Frame1.Width) / Screen.TwipsPerPixelX
        MeHeight = (Frame1.Height) / Screen.TwipsPerPixelY
        MyRet(0) = CreateRoundRectRgn((Frame1.Left + 40) / Screen.TwipsPerPixelX, (Frame1.Top + 0) / Screen.TwipsPerPixelY, MeWidth + Frame1.Left / Screen.TwipsPerPixelX, MeHeight + (Frame1.Top) / Screen.TwipsPerPixelY, 50, 50)
        '-------------frame2成为圆角矩形
        MeWidth = (Frame2.Width) / Screen.TwipsPerPixelX
        MeHeight = (Frame2.Height) / Screen.TwipsPerPixelY
        MyRet(1) = CreateRoundRectRgn((Frame2.Left + 40) / Screen.TwipsPerPixelX, Frame2.Top / Screen.TwipsPerPixelY, MeWidth + Frame2.Left / Screen.TwipsPerPixelX, MeHeight + (Frame2.Top) / Screen.TwipsPerPixelY, 50, 50)'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
    ((Frame2.Left + 40) / Screen.TwipsPerPixelX一定要"+40"才能使保留的位置正,真想不通。
    '''''''''''''''''''''''''''''''''''''''''''''''''''''    '-------------使窗体除frame1和frame2外的区域清除
        MeWidth = Me.Width / Screen.TwipsPerPixelX
        MeHeight = Me.Height / Screen.TwipsPerPixelY
        MyRet(2) = CreateRoundRectRgn(0, 0, MeWidth, MeHeight, 50, 50)
        For i = 0 To 2
            MyCombineRgn(i) = CreateRoundRectRgn(0, 0, MeWidth, MeHeight, 0, 0)
        Next i
        Call CombineRgn(MyCombineRgn(0), MyRet(2), MyRet(0), 1)
        Call CombineRgn(MyCombineRgn(1), MyRet(2), MyRet(1), 1)
        Call CombineRgn(MyCombineRgn(2), MyCombineRgn(1), MyCombineRgn(0), 2)
        Dl = SetWindowRgn(Me.Hwnd, MyCombineRgn(2), True)
        '-----------清除内存中的垃圾
        Dim i As Integer
        For i = 0 To 2
        DeleteObject MyRet(i)
        Next i
        '=================完毕:使frame1和frame2成为圆角矩形并使窗体除frame1和frame2外的区域清除====
        Me.Refresh
    End Sub