🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.os.ms-windows.programmer.misc
3 messages
3 total messages Started by Wolfgang Schmitz (PA Richter) Wed, 27 Jan 1993 13:04
Changing fonts in edit controls
#2371
Author: Wolfgang Schmitz (PA Richter)
Date: Wed, 27 Jan 1993 13:04
14 lines
1099 bytes
I need to change the font used in an edit window. I
trapped the WM_CTLCOLOR message and simply mapped
a different font into the device context provided
by this message. Unfortunately this works only
half way. Although the edit window displays it's
content using the new font, there seems to be
something messed up with the position of the caret.

Any suggestions?


Wolfgang
schmitz@informatik.uni-kl.de
Re: Changing fonts in edit controls
#2388
Author: John Grant
Date: Wed, 27 Jan 1993 20:30
21 lines
1381 bytes
In article <1993Jan27.130447.1129@posthorn.informatik.uni-kl.de> schmitz@vier.informatik.uni-kl.de (Wolfgang Schmitz (PA Richter)) writes:
>
>I need to change the font used in an edit window. I
>trapped the WM_CTLCOLOR message and simply mapped
>a different font into the device context provided
>by this message. Unfortunately this works only
>half way. Although the edit window displays it's
>content using the new font, there seems to be
>something messed up with the position of the caret.

	For the n'th time, if you want to change the font of
	a control, send it a WM_SETFONT message, with the HFONT
	of your choice.  The most common requirement seems to
	be to change the font to a fixed font as follows:

	SendDlgItemMessage(hdlg,id,WM_SETFONT,
		(WPARAM)GetStockObject(SYSTEM_FIXED_FONT),0);
-- 
John A. Grant						jagrant@emr1.emr.ca
Airborne Geophysics
Geological Survey of Canada, Ottawa
Re: Changing fonts in edit controls
#2407
Author: Tom W. Brown
Date: Thu, 28 Jan 1993 19:06
30 lines
1555 bytes
In article <1993Jan27.130447.1129@posthorn.informatik.uni-kl.de>, schmitz@vier.informatik.uni-kl.de (Wolfgang Schmitz (PA Richter)) writes:
|> 
|> I need to change the font used in an edit window. I
|> trapped the WM_CTLCOLOR message and simply mapped
|> a different font into the device context provided
|> by this message. Unfortunately this works only
|> half way. Although the edit window displays it's
|> content using the new font, there seems to be
|> something messed up with the position of the caret.
|> 
|> Any suggestions?

A better way is to set the desired font for the control during
WM_INITDIALOG processing by sending the control a WM_SETFONT
message:

   .
   .
   .
   SendDlgItemMessage(hdlg, IDEDIT, WM_SETFONT, hMyFont, 0L);
   .
   .
   .


----------------------------------------------------------------------------
Tom Brown               |  "She turned me into a newt...
PE Nelson Systems       |                                  ... I got better"
twbrown@pe-nelson.com   |                    Monty Python and the Holy Grail
----------------------------------------------------------------------------
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads