Jump to content
  • Advertisement
Sign in to follow this  
cambalinho

win32 - about DrawTextEx() and RECT

This topic is 1173 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

the RECT with DrawTextEx() is make me confused sad.png

see these code:

RECT b={test.rcPaint.left+2, test.rcPaint.top, test.rcPaint.right-2, test.rcPaint.bottom};
imglabel.DrawText(inst->strCaption, b);

now see the DrawText(), on image class:

void DrawText(string strText,RECT HDCrect)
    {
        char *text=(char*)strText.c_str();
        DrawTextEx(HBitmap,text,-1,&HDCrect,DT_LEFT,NULL);
        //HBitmap is my BitmapDC class that can return HBITMAP and HDC
    }

by some reason, i can't use the top=0 and Left=1. because interfere with the Region results with HBITMAP.

can anyone explain to me the diference bettwen the PAINTSTRUCT hdc and the memory HDC?

(maybe is there the problem for not use the top=0 and Left=1)

Share this post


Link to post
Share on other sites
Advertisement

the problem was resolved:

void DrawText(string strText,int PosX=0, int PosY=0)
    {
        char *text=(char*)strText.c_str();
        RECT b={0};
        b.left=PosX;
        b.right=imageweight;
        b.top=PosY;
        b.bottom=imageheight;
        DrawTextEx(HBitmap,text,strlen(text),&b,DT_LEFT ,NULL);
    }

destroying the old Region before the new Region:

TransparentBlt(test.hdc,0,0,imglabel.width(),imglabel.height(),imglabel,0,0, imglabel.width(),imglabel.height(), inst->clrBackColor);
SetWindowRgn(inst->hwnd,NULL,TRUE);

inst->LabelRegion=RegionbyBitmap(imglabel, inst->clrBackColor);
SetWindowRgn(inst->hwnd,inst->LabelRegion,TRUE);

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!