Results 1 to 1 of 1

Thread: What's wrong with FillPath and DrawString?

  1. #1

    Thread Starter
    Member
    Join Date
    Sep 2003
    Posts
    47

    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
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width