Hi,
is there an easy way to rotate a lable 90 deg?
thanx
Loading
Hi,
is there an easy way to rotate a lable 90 deg?
thanx
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
FroglegPosted Oct 20, 2013, 7:47 PM
public partial class Form1 : Form
{
Font myFont = new Font("Arial", 14);
Brush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
Point pt;
float deg = 90;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
pt = new Point(30, 10);
}
private void label1_Paint(object sender, PaintEventArgs e)
{
e.Graphics.TranslateTransform(pt.X, pt.Y);
e.Graphics.RotateTransform(deg);//set rotation
e.Graphics.DrawString("Label1", myFont, myBrush, 0,0);
}
private void rb1_CheckedChanged(object sender, EventArgs e)
{
if (rb1.Checked)
{
pt.X = 30;
pt.Y = 10;
deg = 90;
label1.Refresh();
}
}
private void rb2_CheckedChanged(object sender, EventArgs e)
{
if (rb2.Checked)
{
pt.X = 10;
pt.Y =75;
deg = 270;
label1.Refresh();
}
}
}
Jignesh TrivediPosted Oct 21, 2013, 12:57 AM
Hi,
If you asp.net usee than this can be acheive by using CSS
Please refer
http://forums.asp.net/t/1811106.aspx
if you are winform base application user
please refer
http://stackoverflow.com/questions/1371943/c-sharp-vertical-label-in-a-winform
hope this will help you.