c# - ScrollWindow has Absolutely No Effect -
i'm creating user control winforms , have need scroll section of control window.
inexplicably, appears no scrollwindow() method available in winforms. i'm trying use interopservices use win32 api scrollwindow() function using variations of following:
[structlayout(layoutkind.sequential)] public struct rect { public int left; public int top; public int right; public int bottom; public rect(rectangle rect) { this.bottom = rect.bottom; this.left = rect.left; this.right = rect.right; this.top = rect.top; } } [dllimport("user32")] public static extern int scrollwindow(intptr hwnd, int nxamount, int nyamount, ref rect rectscrollregion, ref rect rectclip); void myscrollfunc(int yamount) { rect r = new rect(clientrectangle); scrollwindow(handle, 0, yamount, ref r, ref r); }
the result code absolutely nothing. i've tried sorts of variations of code, including calling update() after scroll (which shouldn't necessary).
scrollwindow() returning 1, signifies success has no effect on content of control window no matter try.
does know if there's user control prevents modifying display way? i'm testing on c# express edition 2008 on windows xp.
as will
pointed out in comment, can make user control scrollable setting autoscroll
property - there no need tap win32 api achieve functionality.
if want use api, @ least use scrollwindowex
instead of scrollwindow
.
update: since randomly guessed this, answer is:
pass null
2 rect
parameters.
Comments
Post a Comment