0

I'm using C# class GraphicsPath to change the text into vector.

here is the code

        GraphicsPath path = new GraphicsPath();
        FontFamily family = new FontFamily( "Arial" );
        int fontStyle = (int)FontStyle.Regular;
        int emSize = 100;
        Point origin = new Point( 20, 20 );
        StringFormat format = StringFormat.GenericDefault;
        path.AddString( "Hello", family, fontStyle, emSize, origin, format );
        PointF[] points = path.PathPoints;
        byte[] types = path.PathTypes;

Everything works well except PathTypes return by GraphicsPath instance.

As msdn says, each path types in byte value shows the type of this point.

These types value are 0, 1, 3, 0x70, 0x20, 0x80, indicate the type of point.

When I use code above to get the path points of "hello". Then draw the text again

with Graphic.drawLine method, which each line is made from two point in pathpoints array.

Here is result I got. http://ppt.cc/IwedS

"Hello" at the end is combined with lines. I've two question:

1.At last point of 'H', I get point type value 161. The value is not showing in the msdn document. And I also get 131, 163 at end point. What do they mean?

2.How do I know the path is closed, since I can close 'H' by line the end point and first. But do nothing if it is open.

Thanks a lot

jobamei
  • 11
  • 6

0 Answers0