Sign in to follow this  

DC output - changing it

This topic is 4838 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

how do I change the font used in a DC with TextOut() it defaults to a bold font and its ugly , I tried sending a WM_SETTEXT message but it does nothing I cant seem to get that working , but then that wouldnt change the font used in TextOut() would it?, also I want to be able to change the background colour of the text , can somebody point me in the right direction? , a link or example anything , thanks

Share this post


Link to post
Share on other sites
You need to load a font, and call SelectObject on the DC with it, for example:

HFONT hFont = (HFONT)GetStockObject(ANSI_VAR_FONT); // or create one here
SelectObject(hDC, hFont);

// now call TextOut

To change the color use SetBkColor(hDC, RGB(r, g, b)) or what you probably want is SetBkMode(hDC, TRANSPARENT).

Share this post


Link to post
Share on other sites
That works pretty well , the text is still bold tho I used

GetStockObject(DEFAULT_GUI_FONT);

I'm sendin the text to an Edit control? is that why its still bold? , what i really wanna do is change the text in the edit control , I tried

SendMessage(hEdit, WM_SETTEXT, (WPARAM) "text",0);

but I think theres summin wrong with that , I dont think I've done it right

Share this post


Link to post
Share on other sites

This topic is 4838 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this