title: How to draw a triangle?
body: <p>I've inherited the Control class to create a custom user control used to put some shapes, I would like to draw a triangle inside the control counds and I'm drawing an inner border in the triangle but I have messed my head with the pointers, I can't find the right calculation of the points (maths are not my speciality) then instead a triangle I get this ugly figure:</p>
  
  <p><img src="https://i.stack.imgur.com/dhS62.png" alt="enter image description here"></p>
  
  <p>Below is the relevant part of the code that draws the lines, the problem I think is the fourth <code>PointF</code></p>
  
  <blockquote>
    <p>Notes</p>
  </blockquote>
  
  <p><code>p</code> object is the <code>Pen</code> instance that I use to draw the lines.</p>
  
  <p>The <code>BorderWidth</code> property of the property grid in the image above is just to set the <code>p.Width</code></p>
  
  <blockquote>
    <p>Code</p>
  </blockquote>
  
  <pre><code>Case Figures.Triangle
      Dim trianglePoints As PointF() =
          {
              New PointF(p.Width / 4.0F, CSng(Me.Height) + (p.Width / 2.0F)),
              New PointF(CSng(Me.Width) / 2.0F, p.Width),
              New PointF(CSng(Me.Width) - (p.Width / 4.0F), CSng(Me.Height) + (p.Width / 2.0F)),
              New PointF(-CSng(Me.Height) + p.Width, CSng(Me.Width / 2) - p.Width)
          }
  
      Using gp As New Drawing2D.GraphicsPath(FillMode.Alternate)
  
          gp.AddLines(trianglePoints)
          gp.CloseFigure()
  
          With e.Graphics
  
              If Not Me._InnerColor = Color.Transparent Then
  
                  Using b As New SolidBrush(Me._InnerColor)
                      .FillPath(b, gp)
                  End Using
  
              End If
  
              .DrawLines(p, trianglePoints)
  
          End With
  
      End Using
  </code></pre>