We help IT Professionals succeed at work.
Get Started

Drawing a triangle in a picture box

Last Modified: 2012-06-21
Hi there

I am trying to draw a triangle in a picture box.  I don't seem to get an error but nothing is displaying in the picture box.  Does anyone know what I am doing wrong?  I have tried pic.refresh and that doesn't seem to do anything
  Dim poly(3) As PointF ', NumCoords As Long, hBrush As Long, hRgn As Long

                poly(1).X = 0
                poly(1).Y = 0
                poly(2).X = 0
                poly(2).Y = pic.Height
                poly(3).X = pic.Width
                poly(3).Y = pic.Height

            'Get PictureBox's Graphics Object
            Dim gr As Graphics = pic.CreateGraphics
            Dim pn As Pen = Pens.AliceBlue
            gr.DrawPolygon(pn, poly)

Thanks for your help in advance
Watch Question
This problem has been solved!
Unlock 2 Answers and 4 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE