在.Net环境GDI+下,文字是不能倾斜绘制的,但是可以倾斜整个图像.所以,我们可以通过倾斜图像来实现绘制倾斜文字.如下
倾斜文字
objGraphics.TranslateTransform(fltX1, fltY1); //平移图像(原点)
objGraphics.RotateTransform(XRotateAngle, MatrixOrder.Prepend); //旋转图像
objGraphics.DrawString(Keys[0].ToString(), new Font("宋体", FontSize), new SolidBrush(SliceTextColor), 0, 0);
objGraphics.ResetTransform(); //重置图像
实现效果:(X轴文字)
以上代码和图片实现来自我的另外一篇文章:用 C# 绘制曲线图(Curve图,增加自动适应和多曲线绘制)