HeaderPane
Main
Hide

SftTree/DLL 8.0 - Tree Control

Share Link
Print

DPI

Returns the effective DPI for the monitor the tree control is currently displayed on.

C

int WINAPI SftTree_GetDPI(HWND hwndCtl);
int WINAPI SftTreeSplit_GetDPI(HWND hwndCtl);

C++

int CSftTree::GetDPI() const;
int CSftTreeSplit::GetDPI() const;

Parameters

hwndCtl

The window handle of the tree control.

Returns

The return value is the effective DPI (dots-per-inch) for the monitor the tree control is currently displayed on. 96 represents 100% scaling, 120 represents 125%, 144 represents 150%, 192 represents 200%, and so on.

If the host process is not Per-Monitor DPI aware, the return value is the System DPI and does not change for the lifetime of the process.

Comments

The GetDPI function returns the effective DPI for the monitor the tree control is currently displayed on. The tree control uses this value internally to scale row height, grid-line thickness, scroll-bar metrics, drag thresholds, 3D frame widths, the column drop-down button, expand / collapse glyphs and the resize-handle bitmap via GetSystemMetricsForDpi and MulDiv.

Applications that host SftTree controls in a Per-Monitor v2 DPI-aware window receive a SFTTREEN_DPI_CHANGED notification whenever the window moves to a monitor of a different DPI, or the system DPI changes. In response, the application should:

Callers that have opted into SFTTREE_PIXELSCALING_STRETCH do not need to rescale column widths, indentation, row-header width, horizontal extent or item heights - the tree control handles those automatically. Callers that have opted into SFTTREE_IMAGESCALING_STRETCH do not need to re-register images at the new physical size.

Owner-draw callbacks receive the current DPI in SFTTREE_OWNERDRAW's dpi field; owner-draw code should read the field on every paint and must not cache pixel metrics across callbacks.

See Also C/C++ API | Categories | Notifications