Announcement

Collapse
No announcement yet.

GraphicsPath.AddString contra Graphics.DrawString

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • GraphicsPath.AddString contra Graphics.DrawString

    Hallo,
    eigentlich möchte ich beim Zeichnen eines Strings lieber GraphicsPath anstelle von Graphics nutzen.
    Leider sieht die Ausgabe bei der Benutzung von GraphicsPath total gestaucht aus. Woran kann dies liegen?

    Version 1 - Graphics

    g.DrawString("Teststring",
    new Font("Arial", 12),
    Brushes.Black,
    20, 20);

    Version 2 - GraphicsPath

    using (GraphicsPath gp = new GraphicsPath())
    {
    gp.AddString("Teststring",
    new FontFamily("Arial"),
    (int)FontStyle.Regular,
    12,
    new PointF(20,60),
    StringFormat.GenericDefault);
    g.FillPath(Brushes.Black, gp);
    }

    Torsten

  • #2
    Liegt vermutlich daran, dass du das Rectangle, in welchem der Text erstellt werden soll, zu klein gemacht hast

    Comment

    Working...
    X