Esempio n. 1
0
        public void performScrollVertical(ScrollEventType type)
        {
            int sbfromScrollEventType = this.getSBFromScrollEventType(type);

            if (sbfromScrollEventType != -1)
            {
                ScrollablePanel.SendMessage(base.Handle, 277u, (UIntPtr)((ulong)((long)sbfromScrollEventType)), (IntPtr)0);
            }
        }
Esempio n. 2
0
        private ScrollEventType getScrollEventType(IntPtr wParam)
        {
            ScrollEventType result;

            switch (ScrollablePanel.LoWord((int)wParam))
            {
            case 0:
                result = ScrollEventType.SmallDecrement;
                break;

            case 1:
                result = ScrollEventType.SmallIncrement;
                break;

            case 2:
                result = ScrollEventType.LargeDecrement;
                break;

            case 3:
                result = ScrollEventType.LargeIncrement;
                break;

            case 4:
                result = ScrollEventType.ThumbPosition;
                break;

            case 5:
                result = ScrollEventType.ThumbTrack;
                break;

            case 6:
                result = ScrollEventType.First;
                break;

            case 7:
                result = ScrollEventType.Last;
                break;

            case 8:
                result = ScrollEventType.EndScroll;
                break;

            default:
                result = ScrollEventType.EndScroll;
                break;
            }
            return(result);
        }
Esempio n. 3
0
        protected override void WndProc(ref Message msg)
        {
            base.WndProc(ref msg);
            if (!(msg.HWnd != base.Handle))
            {
                int num = msg.Msg;
                switch (num)
                {
                case 276:
                    try
                    {
                        ScrollEventType scrollEventType = this.getScrollEventType(msg.WParam);
                        ScrollEventArgs e = new ScrollEventArgs(scrollEventType, ScrollablePanel.GetScrollPos(base.Handle, 0));
                        this.ScrollHorizontal(this, e);
                    }
                    catch (Exception)
                    {
                    }
                    break;

                case 277:
                    try
                    {
                        ScrollEventType scrollEventType = this.getScrollEventType(msg.WParam);
                        ScrollEventArgs e = new ScrollEventArgs(scrollEventType, ScrollablePanel.GetScrollPos(base.Handle, 1));
                        this.ScrollVertical(this, e);
                    }
                    catch (Exception)
                    {
                    }
                    break;

                default:
                    if (num == 522)
                    {
                        if (this.VisibleAutoScrollVertical)
                        {
                            try
                            {
                                int delta = ScrollablePanel.HiWord((int)msg.WParam);
                                int y     = ScrollablePanel.HiWord((int)msg.LParam);
                                int x     = ScrollablePanel.LoWord((int)msg.LParam);
                                num = ScrollablePanel.LoWord((int)msg.WParam);
                                MouseButtons button;
                                if (num <= 16)
                                {
                                    switch (num)
                                    {
                                    case 1:
                                        button = MouseButtons.Left;
                                        goto IL_103;

                                    case 2:
                                        button = MouseButtons.Right;
                                        goto IL_103;

                                    default:
                                        if (num == 16)
                                        {
                                            button = MouseButtons.Middle;
                                            goto IL_103;
                                        }
                                        break;
                                    }
                                }
                                else
                                {
                                    if (num == 32)
                                    {
                                        button = MouseButtons.XButton1;
                                        goto IL_103;
                                    }
                                    if (num == 64)
                                    {
                                        button = MouseButtons.XButton2;
                                        goto IL_103;
                                    }
                                }
                                button = MouseButtons.None;
IL_103:
                                MouseEventArgs e2 = new MouseEventArgs(button, 1, x, y, delta);
                                this.ScrollMouseWheel(this, e2);
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                    break;
                }
            }
        }