Click here to Skip to main content
15,745,916 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
It works quite nicely and all of the typical controls, like edit, button, list control, static labels, combo boxes, etc. redraw themselves with the larger font when they receive the WM_SETFONT message I send to each of them as part of the scaling routine.

On the other hand, the Command Link button (class "Button", style bit BS_COMMANDLINK) does not repaint itself with the larger font I pass to it via the WM_SETFONT message.

So how do I enlarge the text in a command link button using the windows API/GDI?

I thank you in advance for any answers you may provide.

What I have tried:

First try:
m_try.ModifyStyle(BS_COMMANDLINK, 0);
m_font.CreateFont(199, 0, 0, 0, FW_BOLD, 0, 0, 0, 0, 0, 0, 0, 0, L"Arial");
::SendMessage(m_try.GetSafeHwnd(), WM_SETFONT, WPARAM(HFONT(m_font)), 0);
::SendMessage(m_try.GetSafeHwnd(), WM_SETTEXT, 0, (LPARAM)L"Command link");
::SendMessage(m_try.GetSafeHwnd(), BCM_SETNOTE, 0, (LPARAM)L"with note");

second try:
LOGFONT logFont;
logFont.lfWeight = FW_BOLD;
logFont.lfHeight = 120;


3rd try;
CFont font2;
CFont* big_font = &font2;
Updated 2-Dec-20 1:13am
Richard MacCutchan 1-Dec-20 3:56am    
I notice that you do not check the result of your call to CreateFont. Are you sure it is returning a valid font object?
Rick York 1-Dec-20 3:58am    
That is a good possibility. The height, first parameter, doesn't look valid to me. In the sample I mentioned it used a height of 50.
Rick York 1-Dec-20 3:57am    
It appears you found and that didn't work? I suspect something else is going on to block it if it doesn't work correctly.
Member 14837073 1-Dec-20 4:13am    
I try with above the link its not working , help me for the any others method
Richard MacCutchan 1-Dec-20 4:26am    
Do what I suggested and check the return value from your calls to CreateFont. You need to be sure that the system is creating a valid font for you.

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