Link to home
Start Free TrialLog in
Avatar of marioraposo
marioraposo

asked on

.net compact framework rotatetransform

As I can nor use RotateTransform in .net compact framework
how can I draw a string rotated 90 degrees in a panel ?
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

check the code snippe, taken from http://msdn.microsoft.com/en-us/library/aa287525(VS.71).aspx
private void DrawVerticalText()
{
   System.Drawing.Graphics formGraphics = this.CreateGraphics();
   string drawString = "Sample Text";
   System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 16);
   System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
   float x = 150.0f;
   float y = 50.0f;
   System.Drawing.StringFormat drawFormat = new System.Drawing.StringFormat(StringFormatFlags.DirectionVertical);
   formGraphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
   drawFont.Dispose();
   drawBrush.Dispose();
   formGraphics.Dispose();
}

Open in new window

Avatar of marioraposo
marioraposo

ASKER

when I write you code in vb.net


        Dim formGraphics As System.Drawing.Graphics = Panel2.CreateGraphics()
        Dim drawString As String = "Sample Text"
        Dim Brush1 As SolidBrush = New SolidBrush(Color.White)
        Dim Font1 As Font = New Font("ARIAL", 20, FontStyle.Bold)
        Dim x As Single = 150.0F
        Dim y As Single = 50.0F
        Dim drawFormat As New System.Drawing.StringFormat(System.Drawing.StringFormat.DirectionVertical)



Error      1      'DirectionVertical' is not a member of 'System.Drawing.StringFormat'




        formGraphics.DrawString(drawString, Font1, Brush1, x, y, drawFormat)
        formGraphics.Dispose()
ASKER CERTIFIED SOLUTION
Avatar of Meir Rivkin
Meir Rivkin
Flag of Israel image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I replaced the statement and I have the same error


Error      1      'DirectionVertical' is not a member of 'System.Drawing.StringFormatFlags'


Please notice that I am using the compact framework
ok, in that case u can use Microsoft.WindowsCE.Forms classes:

http://msdn.microsoft.com/en-us/library/ms404359.aspx