我可以旋轉面板和文本90º,它適用於我。但旋轉180º不起作用,我看不到文字。我能做些什麼來解決它?C#旋轉變換
else if (m_orientation == AfyLabelOrientation.TurnedLeft90)
{
e.Graphics.TranslateTransform(0, this.Height - 5);
e.Graphics.RotateTransform(270);
if (!TextShadow_)
{
e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), new RectangleF(Padding.Left, Padding.Top, this.Height, this.Width));
}
else if (TextShadow_)
{
//Drawing text shadow
e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(Color.Gray), new RectangleF(Padding.Left + 1, Padding.Top - 1, this.Height, this.Width));
//Drawing text
e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), new RectangleF(Padding.Left, Padding.Top, this.Height, this.Width));
}
}
else if(m_orientation == AfyLabelOrientation.Overturned)//This don't work
{
e.Graphics.TranslateTransform(this.Width, 0);
e.Graphics.RotateTransform(180);
if (!TextShadow_)
{
e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), new RectangleF(Padding.Left, Padding.Top, this.Height, this.Width));
}
else if (TextShadow_)
{
//text shadow
e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(Color.Gray), new RectangleF(Padding.Left + 1, Padding.Top - 1, this.Height, this.Width));
//text
e.Graphics.DrawString(this.Text, this.Font, new SolidBrush(this.ForeColor), new RectangleF(Padding.Left, Padding.Top, this.Height, this.Width));
}
}
你可能會問一個更清晰的問題嗎?它似乎更多的是一個聲明 – JonE
如何使180旋轉工作正確。 – Zuhan
可能當你旋轉時,對象正在改變他的座標,它的翻譯。 – Butzke