2012-01-11 130 views

答えて

10

PushTransformPopの方法をDrawingContextクラスとする必要があります。

DrawingContext dc; // Initialize this correct value 
RotateTransform RT = new RotateTransform(); 
RT.Angle = 90 
dc.PushTransform(RT) 
dc.DrawText(...); 
dc.Pop(); 
3
DrawingContext dc; 
Point textLocation 
var RT = new RotationTransform(-90.0); 

// You should transform the location likewise... 
location = new Point(-location.Y, location.X); 

dc.PushTransform(RT); 
dc.DrawText(formattedText, location); 

私はこれを理解しようとしている15分間の壁に頭を打ったので、申し訳ありませんが、私はこれを投稿していました。私は他の誰かがそれを通過することを望んでいない。ここで

+1

RotateTransformのコンストラクタにxとyを渡し、私は転換することを追加したいという古いです90度の角度で動作するPoint()ctorの値を '手動で'交換するのではなく、別の変換オブジェクトで位置を指定する必要があります。テキストの位置を持つTranslateTransformオブジェクトを作成し、回転の前にプッシュすると、コードは任意の角度で動作します。 – user2261015

-1

私の解決策である:それは、テキスト原点を中心変換回転を作成する必要があるので、我々はこの答えAltough

 ... 
     // ft - formatted text, (x, y) - point, where to draw    
     dc.PushTransform(new RotateTransform(-90, x, y)); 
     dc.DrawText(ft, new Point(x, y)); 
     dc.Pop(); 
     ... 
+2

答えを説明するためにテキストを追加することを検討してください。 –

関連する問題