PDA

Click to See Complete Forum and Search --> : EMERGENCY, fonts at angles!!!


Sam Finch
Dec 21st, 2000, 08:22 PM
Sorry to get you guys to do my work for me, but this is a bit of a chrisis.

Basicly I'm going away for christmas in a couple of hours and the guys I'm working for have just emailed me asking me to change some code. I'm sending back some pointers on how to do It as I really don't have time, but I need to explain how to change the angle of the font using the API.

I can't test this lot or anything but I'm pretty sure the API's you need are these



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(1 To LF_FACESIZE) As Byte
End Type


Private Declare Function GetObject Lib "gdi32" Alias "GetObjectA" (ByVal hObject As Long, ByVal nCount As Long, lpObject As Any) As Long
Private Declare Function SelectObject Lib "gdi32" Alias "SelectObject" (ByVal hdc As Long, ByVal hObject As Long) As Long
Private Declare Function CreateFontIndirect Lib "gdi32" Alias "CreateFontIndirectA" (lpLogFont As LOGFONT) As Long
Private Declare Function DeleteObject Lib "gdi32" Alias "DeleteObject" (ByVal hObject As Long) As Long



use select object to get the handle of the font in a DC, then getobject to fill a LOGFONT with the font data, then change the Escapement and orientation to the angle you want the font at ( in 1/10ths of degrees measured anti-clockwise from the +ve x axis

then use createfont indirect and deleteobject selectobject to put the New font in the DC.



I'm sorry to have to ask so much, but this is really important and very bad Timing, I'm not sure how much API experience they have, I think it's very little.

If anyone could help I'd be so greatful.

Thanks.

parksie
Dec 21st, 2000, 08:30 PM
Back shortly...

parksie
Dec 21st, 2000, 08:36 PM
Okay - these should help:

http://www.vbaccelerator.com/codelib/sidelogo/sidelogo.htm
http://www.katisha.demon.co.uk/vb/tips/ui_gfx/angle_text.html

Forgot I had that last one (strange considering I wrote it!)