在vb中,窗体可不可以建成圆形的?
如果可以,请把代码给我,谢谢.

解决方案 »

  1.   

    API:
    SetWindowRng()
    不但圆形,什么形状都可以实现。
      

  2.   

    可以的。
    用 CreateEllipticRgn 和 SetWindowRng函数可以实现。
      

  3.   

    可以的
    用API函数SetWindowRng
      

  4.   

    Private Declare Function CreateEllipticRgn 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 Long) As LongPrivate Sub Form_Load()
        Dim lngRegion As Long
        Dim lngReturn As Long
        Dim lngFormWidth As Long
        Dim lngFormHeight As Long
        
        lngFormWidth = Me.Width / Screen.TwipsPerPixelX
        lngFormHeight = Me.Height / Screen.TwipsPerPixelY
        lngRegion = CreateEllipticRgn(0, 0, lngFormWidth, lngFormHeight)
        lngReturn = SetWindowRgn(Me.hWnd, lngRegion, True)
    End Sub