日期:2014-05-20  浏览次数:20775 次

【GDI+求助】关于GraphicsPath 追加字符串的问题
RT,我想在GraphicsPath追加一串字符串,但是包含GraphicsPath的矩形范围的宽度是固定的,如何能让追加的字符串在快要超出限制的宽度的时候自动换行呢???GDI+中的GraphicsPath中有这样的属性或者方法吗?
我截个图给你们看:


你看 现在不会自动换行.
贴代码:


if (textHasFrame)
                {
                    stringFormat = StringFormat.GenericDefault;
                    Brush brush = new SolidBrush(Color.FromArgb(this.dColor));
                    SizeF sf = Paint.MeasureText("测", this.fTextSize);
                    // 设置创建的路径对象
                    myPath.AddString(this.text,
                                     new FontFamily(/*StaticField.DrawText_FONT_FORMAT*/"宋体"),
                                     (int)this.textStyle,
                        /*StaticField.DrawText_TextRectHeight*/
                                     sf.Height,
                        /*new RectangleF((float)this.MinX, (float)this.MinY, (float)this.widthEx, (float)this.heightEx)*/
                                     new PointF((float)this.MinX, (float)this.MinY),
                                     stringFormat);

                    //Draw the path to the screen.            
                    g.FillPath(brush, myPath);
                    g.DrawPath(new Pen(this.textFrameColor, this.textFrameWidth), myPath);
                }



用Path是为了实现有描边的效果的.