How to create a polygon?

How can you place a shape on a form that looks a bracket [  :
    _____
   |  ___|
   |  |
   |  |__
   |_____|

Can you use the shape control and modify it or do you need to draw it out with Lines or what?
pg6111Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

tureCommented:
pq6111,

Draw three rectangular shapes. Set fillcolor to black and fillstyle to solid.

Ture Magnusson
Karlstad, Sweden
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tureCommented:
..if you don't want it filled, draw it with six straight lines.

/Ture
0
pg6111Author Commented:
We want to draw the polygon as one shape and not three filled-in rectangles.  We tried that and then when we moved it around we had a hard time getting it to line up again.  It would make it a lot easier if it was just one piece.
0
tureCommented:
How about this one, then? It will have the bracket in just one piece, easily moveable...

Draw a bracket in a drawing program, save it as a GIF file with transparent background and load it into an Image control.

/Ture
0
Erick37Commented:
The Polygon API lets you draw any shape.  This example draws a blue bracket on the form.  You can size and move it.

EX:

Option Explicit

Private Type POINTAPI
    x As Long
    y As Long
End Type
Private Declare Function Polygon Lib "gdi32" _
    (ByVal hdc As Long, lpPoint As POINTAPI, _
    ByVal nCount As Long) As Long

Private poly_verts() As POINTAPI

Private Sub Form_Load()
    Dim i As Long
    'Define shape
    ReDim poly_verts(0 To 7) '8 vertices
    poly_verts(0).x = 0
    poly_verts(0).y = 0
    poly_verts(1).x = 5
    poly_verts(1).y = 0
    poly_verts(2).x = 5
    poly_verts(2).y = 2
    poly_verts(3).x = 2
    poly_verts(3).y = 2
    poly_verts(4).x = 2
    poly_verts(4).y = 8
    poly_verts(5).x = 5
    poly_verts(5).y = 8
    poly_verts(6).x = 5
    poly_verts(6).y = 10
    poly_verts(7).x = 0
    poly_verts(7).y = 10
    'scale 4x, move 100 pixels from top and left
    For i = 0 To 7
        poly_verts(i).x = (poly_verts(i).x * 4) + 100
        poly_verts(i).y = (poly_verts(i).y * 4) + 100
    Next
    'Setup draw mode
    Me.FillStyle = 0 'Opaque
    Me.FillColor = vbBlue
    Me.DrawWidth = 1
    Me.DrawStyle = 0 'Solid
End Sub

Private Sub Form_Paint()
    'Device hdc, address of point array, number of points
    Polygon hdc, poly_verts(0), 8
End Sub
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.