[comp.windows.ms.programmer] fonts on buttons

dave@wucs1.wustl.edu (David T Mitchell III) (03/12/91)

How do I set the font for a child window (non-dialog box)?

For instance, I have a window that's got Helv 8pt type in
it, and I'd like to make the pushbuttons 8pt as well.

thanks

dave	dave@wucs1.wustl.edu
	the mira corporation
	314/434-4343

cms2839@isc.rit.edu (a.stranger) (03/13/91)

In article <1991Mar11.184336.5874@cec1.wustl.edu> dave@wucs1.wustl.edu (David T Mitchell III) writes:
>How do I set the font for a child window (non-dialog box)?
>
>For instance, I have a window that's got Helv 8pt type in
>it, and I'd like to make the pushbuttons 8pt as well.
>
				i don't think that you can do this
directly , but you could make a bitmap of the word that you need on the
button in the correct typeface , and then use a button of class owner
draw to display it .


-- 
       @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
       @     "Imagination keeps the shadows away  -  Xymox      @
       @~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~@
       @       a.stranger  -  CMS2839@ritvax.isc.rit.edu        @

dave@wucs1.wustl.edu (David T Mitchell III) (03/16/91)

In article <1991Mar12.230333.10131@isc.rit.edu> cms2839@isc.rit.edu (a.stranger) writes:
>In article <1991Mar11.184336.5874@cec1.wustl.edu> dave@wucs1.wustl.edu (David T Mitchell III) writes:
>>How do I set the font for a child window (non-dialog box)?
>>
>>For instance, I have a window that's got Helv 8pt type in
>>it, and I'd like to make the pushbuttons 8pt as well.
>>
>				i don't think that you can do this
>directly , but you could make a bitmap of the word that you need on the
>button in the correct typeface , and then use a button of class owner
>draw to display it .
>
>       @       a.stranger  -  CMS2839@ritvax.isc.rit.edu        @

I figured it out.  You just need to send the child window a WM_SETFONT message.
The thing that messed me up was that the hFont handle you pass in

	SendMessage(hwndChild, WM_SETFONT, hFont, TRUE/FALSE)

needs to be a handle to a logical font (as in hFont= CreateFont(....)), not
a handle to one selected (as in hFont= SelectObject(hdc, CreateFont(...)) ).

Works fine, now.  Don't forget to DestroyObject your hFont when your all done.

dave	dave@wusc1.wustl.edu
	the mira corporation
	314/434-4343