Rotated Text 
Author Message
 Rotated Text

Is there any way to rotate some text 90 degrees in code, API or
otherwise, without using ielabel.ocx.
Thanks.



Tue, 12 Sep 2000 03:00:00 GMT  
 Rotated Text

Hi Dave,

 Private Declare Function CreateFontIndirect Lib "gdi32" Alias _
     "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
   Private Declare Function SelectObject Lib "gdi32" (ByVal hdc _
     As Long, ByVal hObject As Long) As Long
   Private Declare Function DeleteObject Lib "gdi32" (ByVal _
     hObject As Long) As Long
   Private Const LF_FACESIZE = 32

   Private Type LOGFONT
     lfHeight As Long
     lfWidth As Long
     lfEscapement As Long
     lfOrientation As Long
     lfWeight As Long
     lfItalic As Byte
     lfUnderline As Byte
     lfStrikeOut As Byte
     lfCharSet As Byte
     lfOutPrecision As Byte
     lfClipPrecision As Byte
     lfQuality As Byte
     lfPitchAndFamily As Byte
     lfFaceName as String * LF_FACESIZE
   End Type

   Sub Command1_Click()
     Dim font As LOGFONT
     Dim prevFont As Long, hFont As Long, ret As Long
     Const FONTSIZE = 10 ' Desired point size of font
     font.lfEscapement = 1800    ' 180-degree rotation
     font.lfFaceName = "Arial" & Chr$(0) 'Null character at end
    ' Windows expects the font size to be in pixels and to
     ' be negative if you are specifying the character height
     ' you want.
     font.lfHeight = (FONTSIZE * -20) / Screen.TwipsPerPixelY
     hFont = CreateFontIndirect(font)
     prevFont = SelectObject(Picture1.hdc, hFont)
     Picture1.CurrentX = Picture1.Left + Picture1.Width / 2
     Picture1.CurrentY = Picture1.ScaleHeight / 2
     Picture1.Print "Rotated Text"
     ' Clean up by restoring original font.
     ret = SelectObject(Picture1.hdc, prevFont)
     ret = DeleteObject(hFont)
     Picture1.CurrentY = Picture1.ScaleHeight / 2
     Picture1.Print "Normal Text"
   End Sub

Regards,

Garth Oatley.



Quote:
> Is there any way to rotate some text 90 degrees in code, API or
> otherwise, without using ielabel.ocx.
> Thanks.




Tue, 12 Sep 2000 03:00:00 GMT  
 Rotated Text

Dave-
        Try the Knowledge Base with this
string: "rotate text". Read the first four or five articles
 well- there's a "gotcha".  The KB-
http://support.microsoft.com/support/c.asp
                                Joe
--
***********************************************************

Microsoft Developer MVP- Visual Basic
Check out Yankee Clipper Plus (April 1998
PCWorld magazine "Best Free Stuff Online")
www.tiac.net/users/lvasseur/ycphome.html
**********************************************************
PS- Please reply to the newsgroup- except in the
case of flames, insults, etc. (Don't bother.)



Quote:
> Is there any way to rotate some text 90 degrees in code, API or
> otherwise, without using ielabel.ocx.
> Thanks.




Tue, 12 Sep 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. rotated text box text doesn't print

2. Rotating text on a report

3. Rotating Text

4. Rotate text

5. Rotating Text and Characters using GDI Managed Classes

6. Rotating text in QB 4.5

7. Rotating Text?

8. to print a rotated text

9. Rotating Text?

10. Free OCX for rotated text

11. Rotating Text

12. ROTATE TEXT IN VB ON A FORM

 

 
Powered by phpBB® Forum Software