DrawString: a bit text.
include "gdip.inc"
window 640,480,1
hdc = GetBufferDC()
%UnitPixel = 2
%UnitPoint = 3
Type RectF
single x
single y
single w
single h
End Type
Extern Lib "gdiplus.dll"
! GdipCreateFontFamilyFromName
! GdipCreateSolidFill
! GdipDrawString
! GdipCreateFont
! GdipDeleteFont
! GdipDeleteBrush
! GdipDeleteFontFamily
End Extern
wstring font
Sub SetFontEx(wstring fontname)
font = fontname
end sub
Sub DrawString(single x, y, size, wstring txt)
RECTF fRect = {x, y, ScrW, ScrH}
sys pFont, pFontFamily, pBrush
GdipCreateFontFamilyFromName font, NULL, &pFontFamily
GdipCreateFont pFontFamily, size, FontStyleRegular, UnitPoint, &pFont
GdipCreateSolidFill 0xFFFFFFFF, &pBrush
GdipDrawString hdc, txt, Len(txt), pFont, fRect, NULL, pBrush
GdipDeleteFont pFont
GdipDeleteBrush pBrush
GdipDeleteFontFamily pFontFamily
End Sub
SetFontEx "david"
DrawString 100,100,24,"Hello GdiPlus World"
SetFontEx "georgia"
DrawString 100,124,24,"Hello GdiPlus World"
SetFontEx "gisha"
DrawString 100,158,24,"Hello GdiPlus World"
SetFontEx "impact"
DrawString 100,186,24,"Hello GdiPlus World"
setfontEx "wingdings"
DrawString 100,300,24,"OOOOOOOOOOOO"
for i=0 to 640 step 40
DrawString i,0x0,40,"w"
DrawString i,430,40,"w"
next
waitkey
winEnd