|
|
Title | Draw a filled polygon |
Description | This example shows how to draw a filled polygon in Visual Basic 6. |
Keywords | polygon, fill, filled polygon |
Categories | Graphics |
|
|
This example sets the form's or control's FillStyle, FillColor, ForeColor, and DrawWidth properties to determine how the polygon is drawn and filled. It then uses the Polygon API function to draw the polygon.
|
|
Private Const NUM_POINTS As Integer = 10
Private m_Points(1 To NUM_POINTS) As POINTAPI
Private Declare Function Polygon Lib "gdi32" (ByVal hdc As _
Long, lpPoint As POINTAPI, ByVal nCount As Long) As Long
Private Type POINTAPI
X As Long
Y As Long
End Type
Private Sub Form_Paint()
Me.FillStyle = vbDownwardDiagonal
Me.ForeColor = vbRed
Me.FillColor = vbBlue
Me.DrawWidth = 5
Polygon Me.hdc, m_Points(1), NUM_POINTS
End Sub
|
|
|
|
|
|