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();

 

相关文章:

  • 2021-07-12
  • 2021-11-03
  • 2022-01-08
  • 2021-06-30
  • 2022-02-16
  • 2021-10-01
  • 2022-12-23
猜你喜欢
  • 2021-11-12
  • 2022-12-23
  • 2022-03-03
  • 2021-11-16
  • 2022-12-23
  • 2021-10-02
  • 2022-12-23
相关资源
相似解决方案