문제

I am trying to position something w.r.t. a TJvTreeView, and I would like to know both the width and presence of the vertical scroll view. Does anyone know the canonical way to do that? Or failing that, any way that works?

도움이 되었습니까?

해결책

Test for the presence of the WS_VSCROLL window style:

HasVertScrollBar := (GetWindowLongPtr(hWnd, GWL_STYLE) and WS_VSCROLL) <> 0;

To find the width of system scroll bars, call SystemParametersInfo passing SPI_GETNONCLIENTMETRICS.

var
  ncm: TNonClientMetrics;
....
ncm.cbSize := SizeOf(ncm);
Win32Check(
  SystemParametersInfo(SPI_GETNONCLIENTMETRICS, ncm.cbSize, Pointer(@ncm), 0)
);

The scroll bar width can then be retrieved from ncm.iScrollWidth.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top