Hi,

i have a problem to Draw Text with my current Font. The Program draws the text with the standard font.

.data
FontName db "Verdana",0

.data?
LF  LOGFONT  <>

.code
...

invoke lstrcpy, addr LF.lfFaceName, addr FontName
mov LF.lfHeight, 20
  mov LF.lfWeight, 600
  invoke CreateFontIndirect, addr LF

invoke DrawText, hMemDC,ADDR MyText,-1, ADDR ScreenRect, DT_WORDBREAK or  DT_CENTER

...

Can sb help me?
Posted on 2006-07-12 08:51:50 by n0p
You have to Select the Font into the DC.
Posted on 2006-07-12 08:55:10 by JimmyClif
okay, thx :)

now i know what i have to do, but how can i Select the Font into the DC?
Are there any function i can use? :) sry, i dont know very much about gdi :X
Posted on 2006-07-12 08:58:47 by n0p
Sorry about that :)


invoke SelectObject, hMemDC, hFont

Posted on 2006-07-12 09:04:17 by JimmyClif
sry :X
<-- gdi-noob :D

Edit, I get it, so:

	invoke lstrcpy, addr LF.lfFaceName, addr FontName
mov LF.lfHeight, 10
  mov LF.lfWeight, 600
  invoke CreateFontIndirect, addr LF
invoke SelectObject, hMemDC, eax
?
Posted on 2006-07-12 09:19:21 by n0p
More like this:


.data
Courier_New_9 LOGFONT <-12,0,0,0,400,0,0,0,0,3,2,1,49,"Courier New">
.code
.IF uMsg==WM_CREATE
invoke CreateFontIndirect, addr Courier_New_9
mov hFont, eax
.ELSEIF uMsg==WM_PAINT
invoke BeginPaint, hWnd, addr ps
invoke SelectObject, ps.hdc,hFont
push eax
invoke GetClientRect, hWnd, addr ScreenRect
invoke DrawText, pshdc,ADDR MyText,-1, ADDR ScreenRect, DT_WORDBREAK or??  DT_CENTER
pop eax
invoke SelectObject, ps.hdc, eax
invoke EndPaint, hWnd, addr ps
.ELSEIF uMsg==WM_CLOSE
invoke DeleteObject, hFont


Check out Iczelion's Tut Number 5 at http://win32asm.cjb.net
Posted on 2006-07-12 10:45:20 by JimmyClif