I am trying to draw a "folder" like image using a GraphicsPath.
My function to create the path is the following:
Public Function FolderRect(ByRef r As Rectangle) As System.Drawing.Drawing2D.GraphicsPath
Dim p As New System.Drawing.Drawing2D.GraphicsPath
Dim iTabWidth As Integer = 30
Dim iTabHeight As Integer = 12
With p
Call p.AddLine(r.Left, r.Top, r.Left + iTabWidth, r.Top)
Call p.AddLine(r.Left + iTabWidth, r.Top, r.Left + iTabWidth, r.Top + iTabHeight)
Call p.AddLine(r.Left + iTabWidth, r.Top + iTabHeight, r.Right, r.Top + iTabHeight)
Call p.AddLine(r.Right, r.Top + iTabHeight, r.Right, r.Bottom)
Call p.AddLine(r.Right, r.Bottom, r.Left, r.Bottom)
Call p.AddLine(r.Left, r.Bottom, r.Left, r.Top)
Call p.CloseFigure()
End With
Return p
End Function
The code looks right to me, but the result is not what I expected:
(I created the "correct" version using an image editor).
May this be a bug in the GraphicsPath?