Graphics 文字

System.Drawing.Font myFont = null;

                        if (this.InsertFontInfo[i].bold)
                        {
                            myFont = new System.Drawing.Font(this.InsertFontInfo[i].name, this.InsertFontInfo[i].size, FontStyle.Bold);
                        }
                        else
                        {
                            myFont = new System.Drawing.Font(this.InsertFontInfo[i].name, this.InsertFontInfo[i].size, FontStyle.Regular);
                        }

 // Measure string.
                        SizeF stringSize = new SizeF();
                        //测量文字所占区域
                        stringSize = e.ChartGraphics.Graphics.MeasureString(this.InsertFontInfo[i].content, myFont);

e.ChartGraphics.Graphics.DrawString(this.InsertFontInfo[i].content, myFont, new SolidBrush(this.InsertFontInfo[i].color), myPf, new StringFormat(StringFormatFlags.DirectionVertical));

e.ChartGraphics.Graphics.TranslateTransform(myPf.X, myPf.Y);
                            e.ChartGraphics.Graphics.RotateTransform(this.InsertFontInfo[i].Rtf);
                            if (Math.Abs(this.InsertFontInfo[i].Rtf) == 90)
                            {
                                e.ChartGraphics.Graphics.DrawString(this.InsertFontInfo[i].content, myFont, new SolidBrush(this.InsertFontInfo[i].color), new PointF(-stringSize.Width, 0));
                            }
                            else if (Math.Abs(this.InsertFontInfo[i].Rtf) == 270)
                            {
                                e.ChartGraphics.Graphics.DrawString(this.InsertFontInfo[i].content, myFont, new SolidBrush(this.InsertFontInfo[i].color), new PointF(0, 0));                            
                            }
                            e.ChartGraphics.Graphics.ResetTransform();

 

转载于:https://www.cnblogs.com/zhangjianli/archive/2012/06/01/2530876.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值