[DllImport("user32.dll")]
static extern int ScrollWindowEx(IntPtr hWnd, int dx, int dy, IntPtr prcScroll,
IntPtr prcClip, IntPtr hrgnUpdate, IntPtr prcUpdate, uint flags);
None.
/// <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;
None.
Please add some!
[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 );
}
}
Do you know one? Please contribute it!