Rotating Text and Characters using GDI Managed Classes 
Author Message
 Rotating Text and Characters using GDI Managed Classes

I'm creating a UserControl that for the most part acts like a standard
button however the caption (text) on that button must be able to be
rotatated to 0/90/180/270 degrees.  I also want to rotate each character
within the string by similar angles.  The need arises from wanting to put
text down a high/narrow button.  For example, a high/narrow button I want to
have with the text "ENTER".  It is too narrow to fit across so I want each
character to appear upright, one under the other as in;
        E
        N
        T
        E
        R

Using the example in MSDN under the tree entry .NET Development | .NET
Framework SDK | Programming with the .NET Framework | Frawing and Editing
Images | Using GDI+ Managed Classes | Fonts and Text | Formatting Text, I've
been able to rotate the entire text but not the individual characters.  The
result is my ENTER runs down the button but I have to turn my head on its
ear to read it properly.

In the old VB6 control I used the LOGFONT structure, setting the
lfOrientation property to get this to work.  I can't seem to locate a
similar property / value in the .NET GDI world.  Can anyone help.

Regards
Ian



Sun, 11 Apr 2004 13:33:05 GMT  
 Rotating Text and Characters using GDI Managed Classes


Quote:
> I'm creating a UserControl that for the most part acts like a standard
> button however the caption (text) on that button must be able to be
> rotatated to 0/90/180/270 degrees.  I also want to rotate each character
> within the string by similar angles.  The need arises from wanting to put
> text down a high/narrow button.  For example, a high/narrow button I want to
> have with the text "ENTER".  It is too narrow to fit across so I want each
> character to appear upright, one under the other as in;
>         E
>         N
>         T
>         E
>         R

What happens if you just type "ENTER" for the text of a label that is
narrow and tall, as you indicate?  Otherwise, look into the ScaleTransform
method of the Graphics class.  Using it, you set the transform you want, then
draw the text.

LFS



Sun, 11 Apr 2004 17:56:03 GMT  
 Rotating Text and Characters using GDI Managed Classes


Quote:

> What happens if you just type "ENTER" for the text of a label that is
> narrow and tall, as you indicate?  Otherwise, look into the ScaleTransform
> method of the Graphics class.  Using it, you set the transform you want, then
> draw the text.

Oops, I meant RotateTransform....

<g>
LFS



Sun, 11 Apr 2004 18:11:09 GMT  
 Rotating Text and Characters using GDI Managed Classes
Thanks for the pointer Larry.  I'm still stuck with rotating each character
within the string being printed.  As said earlier, I was able to do this via
the WINAPI by setting the lfOritentation parameter of LogFont.  LogFont
looks like its only half implemented in .NET ie. theres some reference to it
but no help / no detailed structure etc.

Regards
Ian


Quote:


> > What happens if you just type "ENTER" for the text of a label that is
> > narrow and tall, as you indicate?  Otherwise, look into the
ScaleTransform
> > method of the Graphics class.  Using it, you set the transform you want,
then
> > draw the text.

> Oops, I meant RotateTransform....

> <g>
> LFS



Mon, 12 Apr 2004 12:11:11 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Rotated text without GDI calls?

2. rotated text box text doesn't print

3. Image Class Problems (generic GDI + error)

4. Remove control character from text file using qbasic

5. Rotating Character?

6. Text Box to rotate a text string

7. Searching text string variables using wildcard characters

8. Input and display of Vietnamese Characters using text box and label in VB6

9. Rotating single characters in fonts

10. text compare character by character

11. Referencing data from unmanaged code to managed code in C++ Wrapper class

12. RDO framework class to manage a table.

 

 
Powered by phpBB® Forum Software