1

When I scroll horizontally or vertically, the controls collapse with each other until I release the scroll bar and everything draws normally. I already tried with DoubleBuffer and set style after InitializeComponent

SetStyle(ControlStyles.OptimizedDoubleBuffer |
                 ControlStyles.UserPaint |
                 ControlStyles.AllPaintingInWmPaint, true);

I also use:

private const int WM_HSCROLL = 0x114;
private const int WM_VSCROLL = 0x115;

protected override void WndProc(ref Message m)
{
    if ((m.Msg == WM_HSCROLL || m.Msg == WM_VSCROLL)
    && (((int)m.WParam & 0xFFFF) == 5))
    {
        // Change SB_THUMBTRACK to SB_THUMBPOSITION
        m.WParam = (IntPtr)(((int)m.WParam & ~0xFFFF) | 4);
    }
    base.WndProc(ref m);
}

But I'm still having the same problem. This is the normal behavior:

image1

And this is when scrolling behavior:

image2

UPDATE i find a solution but it just Reduces sharpness of that flicker solution

Bena Med
  • 13
  • 5

1 Answers1

0

To handle the issue more efficient, please provide a simple demo to reproduce the issue.

And maybe you can try to override CreateParams.

protected override CreateParams CreateParams
{
    get
    {
        if (Environment.OSVersion.Version.Major >= 6)
        {
            CreateParams cp = base.CreateParams;
            cp.ExStyle |= 0x02000000;
            return cp;
        }
        else
        {
            return base.CreateParams;
        }
    }
}
大陸北方網友
  • 3,696
  • 3
  • 12
  • 37