09-22-2009, 03:14 PM
What's wrong?
Member function __Font.Create2
Function test_rotate_text
Member function __Font.Create2
function# $font [size] [style] [rotate];;style: 1 bold, 2 italic, 4 underline, 8 strikeout
;Creates font.
;If font is "", uses "Tahoma".
LOGFONT lf
if(size)
,int hdc=GetDC(0)
,lf.lfHeight=-MulDiv(size GetDeviceCaps(hdc LOGPIXELSY) 72)
,ReleaseDC 0 hdc
else lf.lfHeight=0
lf.lfWeight=iif(style&1 FW_BOLD FW_NORMAL)
lf.lfItalic=style&2
lf.lfUnderline=style&4
lf.lfStrikeOut=style&8
lf.lfCharSet=1
lf.lfEscapement=rotate
lf.lfOrientation=rotate
if(empty(font)) font="Tahoma"
strncpy(&lf.lfFaceName font 31)
if(handle) DeleteObject handle
handle=CreateFontIndirect(&lf)
Function test_rotate_text
\Dialog_Editor
function# hDlg message wParam lParam
if(hDlg) goto messages
if(!ShowDialog("test_rotate_text" &test_rotate_text)) ret
;BEGIN DIALOG
;0 "" 0x90C80AC8 0x0 0 0 223 135 "Dialog"
;1 Button 0x54030001 0x4 120 116 48 14 "OK"
;2 Button 0x54030000 0x4 170 116 48 14 "Cancel"
;3 Static 0x54000000 0x0 26 14 154 98 "This is a test"
;END DIALOG
;DIALOG EDITOR: "" 0x2030108 "" "" ""
ret
;messages
sel message
,case WM_INITDIALOG
,__Font-- f.Create2("Courier New" 20 1|2 450)
,f.SetDialogFont(hDlg "3")
,case WM_DESTROY
,case WM_COMMAND goto messages2
ret
;messages2
sel wParam
,case IDOK
,case IDCANCEL
ret 1