T
Tsahi Asher
hi,
i'm trying to get the width of the vertical scroll bar for some third party
component* i'm using. so i called the GetScrollBarInfo API like so:
[DllImport("user32.dll", SetLastError = true, EntryPoint =
"GetScrollBarInfo")]
private static extern int GetScrollBarInfo(IntPtr hWnd,
uint idObject, ref SCROLLBARINFO psbi);
with these structs:
[StructLayout(LayoutKind.Sequential)]
public struct SCROLLBARINFO
{
public int cbSize;
public RECT rcScrollBar;
public int dxyLineButton;
public int xyThumbTop;
public int xyThumbBottom;
public int reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public int[] rgstate;
}
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
the call is:
private const uint OBJID_VSCROLL = 0xFFFFFFFB;
SCROLLBARINFO info = new SCROLLBARINFO();
info.cbSize = Marshal.SizeOf(info);
int res = GetScrollBarInfo(gridCtrl.Handle, OBJID_VSCROLL, ref info);
the problem is that the numbers i get in SCROLLBARINFO.rcScrollBar don't
make sense. i get this:
buttom = -2141498754; left = -2141498499; right = 69528148; top
= -1460105884
how do i get the scroll bar width from these numbers?
*DevXpress's VerticalGridControl, if it's familiar to you.
i'm trying to get the width of the vertical scroll bar for some third party
component* i'm using. so i called the GetScrollBarInfo API like so:
[DllImport("user32.dll", SetLastError = true, EntryPoint =
"GetScrollBarInfo")]
private static extern int GetScrollBarInfo(IntPtr hWnd,
uint idObject, ref SCROLLBARINFO psbi);
with these structs:
[StructLayout(LayoutKind.Sequential)]
public struct SCROLLBARINFO
{
public int cbSize;
public RECT rcScrollBar;
public int dxyLineButton;
public int xyThumbTop;
public int xyThumbBottom;
public int reserved;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public int[] rgstate;
}
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
}
the call is:
private const uint OBJID_VSCROLL = 0xFFFFFFFB;
SCROLLBARINFO info = new SCROLLBARINFO();
info.cbSize = Marshal.SizeOf(info);
int res = GetScrollBarInfo(gridCtrl.Handle, OBJID_VSCROLL, ref info);
the problem is that the numbers i get in SCROLLBARINFO.rcScrollBar don't
make sense. i get this:
buttom = -2141498754; left = -2141498499; right = 69528148; top
= -1460105884
how do i get the scroll bar width from these numbers?
*DevXpress's VerticalGridControl, if it's familiar to you.