Hello,
Thank you very much for the answers.
I’m using GetScrollPos for receiving the horizontal scroll position. Also I need LockWindowUpdate to avoid flickering after setting new scroll position.
But it doesn’t work with the vertical scroll position, because GetScrollPos(…, SBS_VERT) returns the position in count of rows and SendMessage(...) needs the position in pixels. Does somebody know how to calculate the pixelsize with the count of rows???
Here my code with horizontal scrole:
Code Snippet
constInt32 LVM_FIRST = 0x1000;
constInt32 LVM_SCROLL = LVM_FIRST + 20;
constint SBS_HORZ = 0;
[
DllImport("user32.dll")]staticexternint GetScrollPos(System.IntPtr hWnd, int nBar);[
DllImport("user32.dll")]staticexternIntPtr SendMessage(IntPtr hWnd, uint Msg, IntPtr wParam, IntPtr lParam);[
DllImport("user32.dll")]staticexternbool LockWindowUpdate(IntPtr Handle);privatevoid UpdateListview()
{
LockWindowUpdate(lvListview.Handle);
int horzScroll = GetScrollPos(lvAnalysis.Handle, SBS_HORZ);
//Code for changing
SendMessage(lvListview.Handle, LVM_SCROLL, (
IntPtr)horzScroll, IntPtr.Zero);LockWindowUpdate(
IntPtr.Zero);
}