.net compact framework rotatetransform

Posted on 2009-12-27
Last Modified: 2013-11-08
As I can nor use RotateTransform in .net compact framework
how can I draw a string rotated 90 degrees in a panel ?
Question by:marioraposo
    LVL 42

    Expert Comment

    check the code snippe, taken from
    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);

    Open in new window


    Author Comment

    when I write you code in

            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)
    LVL 42

    Accepted Solution

    replace ->
    Dim drawFormat As New System.Drawing.StringFormat(System.Drawing.StringFormat.DirectionVertical)
    with ->
    Dim drawFormat As New System.Drawing.StringFormat(StringFormatFlags.DirectionVertical)

    Author Comment

    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
    LVL 42

    Expert Comment

    ok, in that case u can use Microsoft.WindowsCE.Forms classes:

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    A basic question.. “What is the Garbage Collector?” The usual answer given back: “Garbage collector is a background thread run by the CLR for freeing up the memory space used by the objects which are no longer used by the program.” I wondered …
    Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now