Home
Search
 
What's New
Index
Books
Links
Q & A
Newsletter
Banners
 
Feedback
Tip Jar
 
C# Helper...
 
XML RSS Feed
Follow VBHelper on Twitter
 
 
 
MSDN Visual Basic Community
 
 
 
 
 
TitleDraw a filled polygon
DescriptionThis example shows how to draw a filled polygon in Visual Basic 6.
Keywordspolygon, fill, filled polygon
CategoriesGraphics
 
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
 
 
Copyright © 1997-2010 Rocky Mountain Computer Consulting, Inc.   All rights reserved.
  Updated