c#中label里的文字能旋转90度吗?
1个回答
2017-03-18
展开全部
可以不用了label实现吧
private void DrawStringAndRotateAt(System.Windows.Forms.Panel panel,string strChar)
{
//以(100,100)为中心画字符串并旋转
Graphics g = panel.CreateGraphics(); //需要在上面写字的控件
Font font = new Font("Impact ", 30);//字体名称大小
PointF rotatePoint = new PointF(this.panel1.Height / 2, this.panel1.Width / 2); //设定旋转的中心点
SizeF size = g.MeasureString(strChar, font);
Matrix myMatrix = new Matrix();
myMatrix.RotateAt(270, rotatePoint, MatrixOrder.Append); //旋转270度
g.Transform = myMatrix;
g.DrawString(str, font, new SolidBrush(Color.Black), rotatePoint.X - size.Width, rotatePoint.Y - size.Height); //写字
}
private void DrawStringAndRotateAt(System.Windows.Forms.Panel panel,string strChar)
{
//以(100,100)为中心画字符串并旋转
Graphics g = panel.CreateGraphics(); //需要在上面写字的控件
Font font = new Font("Impact ", 30);//字体名称大小
PointF rotatePoint = new PointF(this.panel1.Height / 2, this.panel1.Width / 2); //设定旋转的中心点
SizeF size = g.MeasureString(strChar, font);
Matrix myMatrix = new Matrix();
myMatrix.RotateAt(270, rotatePoint, MatrixOrder.Append); //旋转270度
g.Transform = myMatrix;
g.DrawString(str, font, new SolidBrush(Color.Black), rotatePoint.X - size.Width, rotatePoint.Y - size.Height); //写字
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询