Author Topic: MouseWheel for NickList Control.  (Read 2856 times)

invisal

  • Guest
MouseWheel for NickList Control.
« on: May 11, 2010, 12:11:19 PM »
NickList Control currently does not support mouse wheel. So, I decided to make a small modification to your code.

NickList.cs
Code: [Select]
        private void OnMouseWheel(object sender, MouseEventArgs e)
        {
            if (vScrollBar.Enabled == true)
            {
                if (e.Delta < 0)
                {
                    if (vScrollBar.Maximum < (vScrollBar.Value + 2))
                    {
                        vScrollBar.Value = vScrollBar.Maximum;
                    } else {
                        vScrollBar.Value += 2;
                    }
                } else if (e.Delta > 0) {
                    if (0 > (vScrollBar.Value - 2))
                    {
                        vScrollBar.Value = 0;
                    }
                    else
                    {
                        vScrollBar.Value -= 2;
                    }
                }

                topIndex = vScrollBar.Value;
                Invalidate();
            }
        }

NickList.Design.cs
Code: [Select]
....
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.OnMouseWheel);
....

I hope that will help.

Snerf

  • Administrator
  • Hero Member
  • *****
  • Posts: 1968
    • IceChat IRC Client
Re: MouseWheel for NickList Control.
« Reply #1 on: May 11, 2010, 01:52:35 PM »
Thank you very much, I will add this into the next Alpha release (14.2).
The IceChat God