IceChat Forums

IceChat 9 => IceChat 9 Coding => Topic started by: invisal on May 11, 2010, 12:11:19 PM

Title: MouseWheel for NickList Control.
Post by: invisal 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.
Title: Re: MouseWheel for NickList Control.
Post by: Snerf on May 11, 2010, 01:52:35 PM
Thank you very much, I will add this into the next Alpha release (14.2).