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