Main Menu

Font DPI

Started by James Fuller, June 21, 2016, 12:14:56 PM

Previous topic - Next topic

James Fuller

Jose,
  How does one create a dpi aware font?
The 3rd parameter of AfxCreateFont defaults to 96 according to the help file.
How do I create a font compatible with the actual dpi setting of the host.
I could not find a AfxGetDPI function which appears to be what I need???

James

James Fuller

Duh...
I really should wait a bit before posting questions I am working on :) !!
James


Dim As CWindow pWindow
Dim As HFONT hInfoFont = AfxCreateFont("Tahoma",12,pWindow.DPI)


José Roca

You can also use

Dim As HFONT hInfoFont = pWindow.CreateFont("Tahoma",12)

José Roca

> I could not find a AfxGetDPI function which appears to be what I need???

If you aren't using CWindow, you can use AfxLogPixelsX and or AfxLogPixelsY.