.
Summary
C# Signature:
[DllImport("user32.dll")]
static extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy, IntPtr prcScroll,
IntPtr prcClip, IntPtr hrgnUpdate, IntPtr prcUpdate, uint flags);
User-Defined Types:
None.
Flags:
/// <summary>
/// Scroll children within *lprcScroll.
/// </summary>
public const uint SW_SCROLLCHILDREN = 0x0001;
/// <summary>
/// Invalidate after scrolling.
/// </summary>
public const uint SW_INVALIDATE = 0x0002;
/// <summary>
/// If SW_INVALIDATE, don't send WM_ERASEBACKGROUND.
/// </summary>
public const uint SW_ERASE = 0x0004;
/// <summary>
/// Use smooth scrolling.
/// </summary>
public const uint SW_SMOOTHSCROLL = 0x0010;
Notes:
None.
Tips & Tricks:
Please add some!
Sample Code:
[DllImport( "user32.dll" )]
static extern int ScrollWindowEx(
IntPtr hWnd,
int dx,
int dy,
IntPtr prcScroll,
IntPtr prcClip,
IntPtr hrgnUpdate,
IntPtr prcUpdate,
uint flags );
unsafe private void hScrollBar1_Scroll( object sender, ScrollEventArgs e )
{
int ScrollDelta;
RECT ScrollRect = new RECT();
ScrollDelta = FPosition - e.NewValue; // FPosition is the previous scrollbar position
FPosition = e.NewValue;
if ( ScrollDelta != 0 )
{
ScrollRect.Left = 100;
ScrollRect.Top = 50;
ScrollRect.Right = this.Width - SystemInformation.VerticalScrollBarWidth;
ScrollRect.Bottom = this.Height - 50;
IntPtr RectPointer = new IntPtr( &ScrollRect );
ScrollWindowEx( this.Handle, ScrollDelta, 0, RectPointer, RectPointer, (IntPtr)null, (IntPtr)0, 2 );
}
}
Alternative Managed API:
Do you know one? Please contribute it!
Documentation
The ScrollWindowEx API
3/16/2007 2:30:40 PM - -212.242.149.175
Please edit this page!
Do you have...
helpful tips or sample code to share for using this API in managed code?
corrections to the existing content?
variations of the signature you want to share?
additional languages you want to include?
Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing supporting types needed for this API (structures, delegates, and more).