HeaderPane
Main
Hide

SftTree/DLL 8.0 - Tree Control

Share Link
Print

ImageScaling

Defines how images drawn by the tree control are scaled relative to the current monitor DPI.

C

void WINAPI SftTree_SetImageScaling(HWND hwndCtl, int mode);
int WINAPI SftTree_GetImageScaling(HWND hwndCtl);
void WINAPI SftTreeSplit_SetImageScaling(HWND hwndCtl, int mode);
int WINAPI SftTreeSplit_GetImageScaling(HWND hwndCtl);

C++

void CSftTree::SetImageScaling(int mode);
int CSftTree::GetImageScaling() const;
void CSftTreeSplit::SetImageScaling(int mode);
int CSftTreeSplit::GetImageScaling() const;

Parameters

hwndCtl

The window handle of the tree control.

mode

Defines the image scaling mode. mode can be one of the following values:

SFTTREE_IMAGESCALING_ASISEvery image is drawn at its native pixel size, regardless of the current monitor DPI. This is the default and preserves the traditional SftTree/DLL behavior. On high-DPI monitors, images supplied at 96 DPI appear physically smaller than the surrounding text.
SFTTREE_IMAGESCALING_STRETCHEvery image is scaled by the factor currentDPI / 96 when drawn. On a 150% DPI monitor, a 16-pixel-tall image is drawn 24 pixels tall; on a 200% monitor it is drawn 32 pixels tall. Bitmap images use StretchBlt with HALFTONE mode; GDI+ images use InterpolationModeHighQualityBicubic.

Returns

GetImageScaling returns a value indicating the current image scaling mode (SFTTREE_IMAGESCALING_ASIS or SFTTREE_IMAGESCALING_STRETCH).

Comments

The SetImageScaling and GetImageScaling functions define how images drawn by the tree control are scaled relative to the current monitor DPI. The setting applies to every image the control draws:

  • caller-supplied SFT_PICTURE images used for cell, label, item, row-header, column-header and column-footer pictures,
  • caller-supplied plus/minus bitmaps (SetPlusMinus) and user-supplied tree button bitmaps (SetButtons),
  • tree control owned images - automatic expand / collapse glyphs, legacy glyph sprites, check-mark images used in column-filter drop-downs, and the split-tree resize handle.

SetImageScaling is independent of SetPixelScaling. SetImageScaling controls the size at which images are drawn; SetPixelScaling controls how caller-supplied pixel dimensions (column widths, indentation, row-header width, etc.) are interpreted. Either can be used without the other.

SFTTREE_IMAGESCALING_ASIS (the default) preserves back-compatible behavior - applications that already supply DPI-appropriate images (or that only target 96 DPI) do not need to change anything.

SFTTREE_IMAGESCALING_STRETCH is the simplest way to make an existing application look correct on high-DPI monitors without shipping multiple image sizes, at the cost of some visual softness from the stretch filter. For best image quality at high DPI, supply higher-resolution master images and leave the mode at SFTTREE_IMAGESCALING_ASIS.

When the control is hosted on a Per-Monitor v2 DPI-aware window, the control re-renders automatically on DPI change. Callers who have opted into SFTTREE_IMAGESCALING_STRETCH do not need to re-register images in response to SFTTREEN_DPI_CHANGED.

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