Find the scroll unit of a window
I'm trying to find a way to开发者_JS百科 compute the scroll unit (num. of pixels the screen moves down when u click once on the down arrow in the scrollbar). The msdn documentation for SB_LINEUP says :
Decrements the scroll box position; scrolls toward the top of the data by one unit. In each case, a unit is defined by the application as appropriate for the data.
Is there anyway for us to find out what the value of 1 scroll unit is, for a given window??
Any help would be appreciated. Thanks.
Check out SystemInformation.MouseWheelScrollLines
Property:
The MouseWheelScrollLines property indicates how many lines to scroll, by default, in a multi-line control that has a scroll bar. The corresponding Platform SDK system-wide parameters are SPI_GETWHEELSCROLLLINES and SPI_SETWHEELSCROLLLINES. For more information about system-wide parameters, see "SystemParametersInfo" in the Platform SDK documentation at http://msdn.microsoft.com.
I've found out a way to find it out. For future reference for others:
hdc = GetDC (hwnd);
// Extract font dimensions from the text metrics.
GetTextMetrics (hdc, &tm);
int pixelCnt= tm.tmHeight + tm.tmExternalLeading;
Ref: http://msdn.microsoft.com/en-us/library/bb787531%28VS.85%29.aspx
精彩评论