What is wrong with this code
Posted: Wed Jan 02, 2013 10:49 pm
i have this simple graphics path but i cant fill it with a color
Code: Select all
and i use it with this code
Private Function DrawLeftTriangle(ByVal r As Rectangle) As GraphicsPath
Dim path As New GraphicsPath
path.AddLine(r.X, r.Y + Convert.ToInt32(r.Height / 2), r.X + r.Width, r.Y)
path.AddLine(r.X, r.Y + Convert.ToInt32(r.Height / 2), r.X + r.Width, r.Y + r.Height)
path.AddLine(r.X + r.Width, r.Y, r.X + r.Width, r.Y + r.Height)
path.CloseFigure()
Return path
End Function
Code: Select all
this only draws the outline border but it doesn fill the interior Why? e.Graphics.FillPath(Brushes.Red, DrawLeftTriangle(New Rectangle(50, 50, 10, 10)))
e.Graphics.DrawPath(Pens.Black, DrawLeftTriangle(New Rectangle(50, 50, 10, 10)))