如题!!!

解决方案 »

  1.   

    seehttp://www.mentalis.org/apilist/p.shtml
      

  2.   

    Private Type COORD
        x As Long
        y As Long
    End Type
    Private Declare Function CreatePolygonRgn Lib "gdi32" (lpPoint As Any, ByVal nCount As Long, ByVal nPolyFillMode As Long) As Long
    Private Declare Function Polygon Lib "gdi32" (ByVal hdc As Long, lpPoint As Any, ByVal nCount As Long) As Long
    Private Declare Function FillRgn Lib "gdi32" (ByVal hdc As Long, ByVal hRgn As Long, ByVal hBrush As Long) As Long
    Private Declare Function GetStockObject Lib "gdi32" (ByVal nIndex As Long) As Long
    Private Declare Function DeleteObject Lib "gdi32" (ByVal hObject As Long) As Long
    Const ALTERNATE = 1 ' ALTERNATE and WINDING are
    Const WINDING = 2 ' constants for FillMode.
    Const BLACKBRUSH = 4 ' Constant for brush type.
    Private Sub Form_Paint()    Dim poly(1 To 3) As COORD, NumCoords As Long, hBrush As Long, hRgn As Long
        Me.Cls
        ' Number of vertices in polygon.
        NumCoords = 3
        ' Set scalemode to pixels to set up points of triangle.
        Me.ScaleMode = vbPixels
        ' Assign values to points.
        poly(1).x = Form1.ScaleWidth / 2
        poly(1).y = Form1.ScaleHeight / 2
        poly(2).x = Form1.ScaleWidth / 4
        poly(2).y = 3 * Form1.ScaleHeight / 4
        poly(3).x = 3 * Form1.ScaleWidth / 4
        poly(3).y = 3 * Form1.ScaleHeight / 4
        ' Polygon function creates unfilled polygon on screen.
        ' Re FillRgn statement to see results.
        Polygon Me.hdc, poly(1), NumCoords
        ' Gets stock black brush.
        hBrush = GetStockObject(BLACKBRUSH)
        ' Creates region to fill with color.
        hRgn = CreatePolygonRgn(poly(1), NumCoords, ALTERNATE)
        ' If the creation of the region was successful then color.
        If hRgn Then FillRgn Me.hdc, hRgn, hBrush
        DeleteObject hRgn
    End Sub
    Private Sub Form_Resize()
        Form_Paint
    End Sub
      

  3.   

    Private Type POINTAPI
            X As Long
            Y As Long
    End Type
    Private Declare Function Polyline Lib "gdi32" (ByVal hdc As Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
    Dim Pts(0 To 6) As POINTAPI
    Private Sub Form_Paint()
        Pts(0).X = 10: Pts(0).Y = 10
        Pts(1).X = 10: Pts(1).Y = 100
        Pts(2).X = 10: Pts(2).Y = 50
        Pts(3).X = 50: Pts(3).Y = 10
        Pts(4).X = 10: Pts(4).Y = 50
        Pts(5).X = 50: Pts(5).Y = 100
        Polyline Me.hdc, Pts(0), 6
        Pts(0).X = 60: Pts(0).Y = 100
        Pts(1).X = 60: Pts(1).Y = 10
        Pts(2).X = 100: Pts(2).Y = 10
        Pts(3).X = 100: Pts(3).Y = 50
        Pts(4).X = 60: Pts(4).Y = 50
        Polyline Me.hdc, Pts(0), 5
        Pts(0).X = 110: Pts(0).Y = 10
        Pts(1).X = 150: Pts(1).Y = 10
        Pts(2).X = 160: Pts(2).Y = 20
        Pts(3).X = 160: Pts(3).Y = 90
        Pts(4).X = 150: Pts(4).Y = 100
        Pts(5).X = 110: Pts(5).Y = 100
        Pts(6).X = 110: Pts(6).Y = 10
        Polyline Me.hdc, Pts(0), 7
    End Sub