• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 833
  • Last Modified:

.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 ?
0
marioraposo
Asked:
marioraposo
  • 3
  • 2
1 Solution
 
Meir RivkinFull stack Software EngineerCommented:
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

0
 
marioraposoAuthor Commented:
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()
0
 
Meir RivkinFull stack Software EngineerCommented:
replace ->
Dim drawFormat As New System.Drawing.StringFormat(System.Drawing.StringFormat.DirectionVertical)
with ->
Dim drawFormat As New System.Drawing.StringFormat(StringFormatFlags.DirectionVertical)
0
 
marioraposoAuthor Commented:
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
0
 
Meir RivkinFull stack Software EngineerCommented:
ok, in that case u can use Microsoft.WindowsCE.Forms classes:

http://msdn.microsoft.com/en-us/library/ms404359.aspx
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now