我已經試過這樣:如何使用Graphics對象以特定的程度旋轉RectangleF?
g.RotateTransform(degrees);
但沒有happens.I有一個圖形對象和使用這種方法一個矩形對象女巫IM繪圖:
g.FillRectangle(new TextureBrush(Image.FromFile(@"D:\LOVE&LUA\Pictures\yellowWool.png")), rectangle);
,我需要以某種方式旋轉矩形再次繪製它。
請與代碼示例請與簡單的解釋。
編輯:這是我使用的實際代碼:
public void Draw(Graphics g,PointF location,Color clearColor)
{
rectangle.Location = location;
g.Clear(clearColor);
g.RotateTransform(10);
//g.FillRectangle(new SolidBrush(Color), rectangle);
g.FillRectangle(new TextureBrush(Image.FromFile(@"D:\LOVE&LUA\Pictures\yellowWool.png")), rectangle);
}
每一幀我把這種功能,我使用窗體的Paint事件的e.Graphics
對象的圖形和我有一個timer
女巫只調用this.Refresh();
編輯2: OK我打一點與轉換和g.RotateTransform
旋轉graphycs整個cordinate系統對象,我需要在不改變cordinate系統
你是按這個順序調用兩條線嗎?你能否顯示整個代碼片段(包括諸如實際度數之類的東西) –
沒有TranslateTransform,那很麻煩。 http://www.bobpowell.net/transformations.htm –
@HansPassant - 這很神祕......照顧解釋? –