Click here to Skip to main content
15,885,141 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi , Friends

How can i bold the font Of text in static control ( #32770 )

What I have tried:

I Subclassed to the window with class #32770 with SetWindowLongPtr in win64 But i do not know i have to use CreateFont in which message ? WM_SETTEXT or WM_PAINT
Posted
Updated 20-Jan-22 3:22am

1 solution

You need to do it in response to the WM_PAINT message, where you have full control of what is drawn in the window. The WM_SETTEXT message merely sends some text to be managed by the paint handler.
 
Share this answer
 
Comments
[no name] 20-Jan-22 13:05pm    
is it possible use CreateFontIndirect in WM_PAINT
Richard MacCutchan 21-Jan-22 3:26am    
Yes. Although it may be better to create your fonts elsewhere at the beginning of your application. It all depends on the actual usage.
[no name] 21-Jan-22 7:36am    
last question
when change font size example from 8pt to 23pt the window not extend and some characters not be shown in static control
Richard MacCutchan 21-Jan-22 8:24am    
Then you need to do one of the following:
1. Add scrollbars to allow the content of the Window to be moved.
2. Resize the Window (with the MoveWindow function) to make it big enough to show all the content. Note, in this case make sure the Window does not get too big for its parent.
[no name] 27-Jan-22 4:29am    
Sir,is it possible to put simple code to do ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900