怎么做一个像这样的不规则窗口?
麻烦发代码,对我来说研究代码比教程受用!谢谢

解决方案 »

  1.   

    你的图片是看不到的,给你段代码自己去举一反三吧。Option Explicit
    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 Boolean) As LongPrivate Sub Form_Load()
      SetWindowRgn Me.hWnd, CreateEllipticRgn(0, 0, 300, 200), True
    End Sub
      

  2.   

    用API函数,自己找找。很多源代码
      

  3.   

    本帖最后由 bcrun 于 2011-08-16 14:16:45 编辑
      

  4.   

    还是再贴一段吧 嘎嘎
    Option Explicit
    'Example Name:Path2Region
    Private Declare Function BeginPath Lib "gdi32" (ByVal hdc As Long) As Long
    Private Declare Function EndPath Lib "gdi32" (ByVal hdc As Long) As Long
    Private Declare Function PathToRegion Lib "gdi32" (ByVal hdc As Long) As Long
    Private Declare Function TextOut Lib "gdi32" Alias "TextOutA" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal lpString As String, ByVal nCount 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 Form_Click()
        'end..
        Unload Me
    End Sub
    Private Sub Form_Load()
        Me.Width = 800 * 15
        Me.Height = 600 * 15
        Dim hRgn As Long
        Const sText = "O"
        'set the font to 'Times New Romen, size 72'
        Me.FontName = "Times New Roman"
        Me.FontSize = 256
        'set the backcolor to Red
        Me.BackColor = vbRed
        'open a path bracket
        BeginPath Me.hdc
        'draw the text
        TextOut Me.hdc, 0, 0, sText, Len(sText)
        'close the path bracket
        EndPath Me.hdc
        'convert the path to a region
        hRgn = PathToRegion(Me.hdc)
        'set the Window-region
        SetWindowRgn Me.hWnd, hRgn, True
        'destroy our region
        DeleteObject hRgn
    End Sub