Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

determine visible VScrollBar in ListView

0 views
Skip to first unread message

Vladimir...@gmail.com

unread,
Aug 17, 2005, 8:16:43 PM8/17/05
to
I am trying to find a way how to determine is scrollBar visible in C#.
The target is to subtract its width from calculation of the visible
area in ListView. I have find where I can get the standard size of the
scrollbars but could not find how to check is it enabled on the form.

Thanks

Sergey Bogdanov

unread,
Aug 18, 2005, 1:38:06 AM8/18/05
to
When the vertical scrollbar is visible then its window has WS_VSCROLL
style (or WS_HSCROLL for vertical horizontal scrollbar):

ctrl.Capture = true;
IntPtr hWnd = GetCapture();
ctrl.Capture = false;

bool isVisible = GetWindowLong(hWnd, GWL_STYLE) & WS_VSCROLL) != 0;

...

[DllImport("coredll")]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);

private const int WS_VSCROLL = 0x200000;
private const int GWL_STYLE = (-16);

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com

Vladimir...@gmail.com

unread,
Aug 18, 2005, 7:02:48 AM8/18/05
to
Thanks

0 new messages