1 Attachment(s)
What's wrong with FillPath and DrawString?
Hi. I've tried both the FillPath/DrawPath and DrawString function of the graphics class to draw a string.
FillPath/DrawPath:
Code:
Private Sub pnlCanvas_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles pnlCanvas.Paint
Dim gPath As New GraphicsPath
Dim family As New FontFamily("Tahoma")
Dim style As Integer = CInt(FontStyle.Regular)
Dim emSize As Single = 9
Dim origin As Point = New Point(10, 10)
Dim sformat As StringFormat = StringFormat.GenericDefault
gPath.AddString("Test", family, style, emSize, origin, sformat)
e.Graphics.FillPath(Brushes.DarkBlue, gPath)
Dim fn As New Font("Tahoma", 9, FontStyle.Regular)
e.Graphics.DrawString("Test", fn, Brushes.DarkBlue, 10, 20)
End Sub
However, the string drawn to the panel is different although i specifed the same FontFamily, emSize, etc.
I though that DrawPath will draw the outlines of the string and meanwhile FillPath will fill the interior of the string.
If i used both then, it shall be the same as the DrawString function.
Why does it differs? Any idea anyone?
Attached herewith is a picture.
Archaven