Hello

I have some problem with painting text on my hdc:



;painting alot of another stuff on hMemDC
invoke CreateCompatibleDC,hhdc
mov memDC,eax
invoke DrawText,memDC,addr str1,-1,addr Winrect,DT_SINGLELINE or DT_CENTER or DT_VCENTER
.IF eax==0
invoke MessageBox,NULL,NULL,NULL,MB_OK
.endif
invoke BitBlt,hMemDC,0,0,100,100,memDC,0,0,SRCCOPY
invoke DeleteDC,memDC
;do something else with hMemDC
invoke BitBlt,hhdc, Winrect.left, Winrect.top, eax, ecx,hMemDC, 0, 0, SRCCOPY


my problem is, there isn't coming any text :(
Posted on 2004-04-06 16:29:08 by bj1500
I think you first have to select a font object into the device context. Not sure.
Posted on 2004-04-06 18:08:41 by iblis
use textout insted.

TextOut HDC,x,y,TEXTPTR,lstrlen(TEXTPTR)

it will use default attributes, if you want colors and fonts you have to use the other functions.

SetTextColor(PhdC,TextColor1);//light grey text
SetBkColor(PhdC,BackGroundColor1);//bgof text and other obj

hfntDefault=CreateFont(14,0,0,0,FW_NORMAL,false,false,false,DEFAULT_CHARSET,OUT_TT_ONLY_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH,"TIMES NEW ROMAN");//make a font
sfd = SelectObject(HDC, hfntDefault); //select it

SetBkMode(H_DC, TRANSPARENT);//transparent backgrround to text and other obj
SetBkMode(H_DC, OPAQUE);//back to normal.
Posted on 2004-04-06 19:52:42 by Qages
bj1500
...

local hbmp : HBITMAP
local holdbmp : BITMAP
...
invoke CreateCompatibleDC, hhdc
mov memDC,eax
[b]mov eax,Winrect.right
sub eax,Winrect.left
mov ecx,Winrect.bottom
sub ecx,Winrect.top
invoke CreateCompatibleBitmap, hhdc, eax, ecx
mov hbmp,eax
invoke SelectObject, memDC, hbmp
mov holdbmp,eax[/b]
invoke DrawText, memDC, addr str1, -1, addr Winrect, DT_SINGLELINE or DT_CENTER or DT_VCENTER
.IF eax==0
invoke MessageBox,NULL,NULL,NULL,MB_OK
.endif
invoke BitBlt,hMemDC,0,0,100,100,memDC,0,0,SRCCOPY
[b]invoke SelectObject, memDC, holdbmp
invoke DeleteObject, hbmp[/b]
invoke DeleteDC,memDC
;do something else with hMemDC
invoke BitBlt,hhdc, Winrect.left, Winrect.top, eax, ecx,hMemDC, 0, 0, SRCCOPY
...
Posted on 2004-04-06 21:18:15 by P2M