exPHAT
exPHAT

Reputation: 128

Button and font looks low-res windows.h

I am playing around with a simple C++ window and I created a button with CreateWindowEx, but when I compile and run, the button and its text has a very low resolution.

My button:

ugly

Windows Button:

pretty

Do I have to add something to my .manifest file? or my resource.rc file? I am pretty lost.

Upvotes: 1

Views: 389

Answers (1)

arlo
arlo

Reputation: 56

You need to send a WM_SETFONT message to the control with the font you want it to use.

To get the proper font you call SystemParametersInfo with SPI_GETNONCLIENTMETRICS to have it fill in a NONCLIENTMETRICS struct, then use CreateFontIndirect on the lfMessageFont member of the struct.

Also take a look at this function: SetProcessDPIAware I suspect DPI scaling is what is causing the button to look blurry.

Upvotes: 4

Related Questions