[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 817
  • 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

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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