⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slider_pane.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 4 页
字号:
            }
            this.update_item_window_pos();
        }

        public void calculate_item_window_rect()
        {
            if (this.m_slider_style)
            {
                this.calculate_animated_item_window_rect();
            }
            else
            {
                int index = 0;
                if (this.m_items_dock_bottom)
                {
                    int num2 = 0;
                    Rectangle rectangle = new Rectangle(0, base.ClientRectangle.Height - 1, base.ClientRectangle.Width - 1, base.ClientRectangle.Height - 1);
                    List<slider_item>.Enumerator enumerator = this.m_slider_items.GetEnumerator();
                    try
                    {
                        while (enumerator.MoveNext())
                        {
                            enumerator.get_Current();
                            MeasureItemEventArgs e = new MeasureItemEventArgs(null, index, 0x1a);
                            this.on_measure_item(e);
                            num2 += e.ItemHeight;
                            rectangle.Height = e.ItemHeight;
                            rectangle.Offset(0, -rectangle.Height);
                            index++;
                        }
                    }
                    finally
                    {
                        enumerator.Dispose();
                    }
                    this.m_item_window_rect.Location = new Point((base.Location.X + base.ClientRectangle.Left) + 1, (base.Location.Y + base.ClientRectangle.Top) + 1);
                    this.m_item_window_rect.Size = new Size(base.ClientRectangle.Width - 2, (num2 < (base.ClientRectangle.Height - 2)) ? ((base.ClientRectangle.Height - 2) - num2) : 0);
                }
                else
                {
                    int num3 = 0;
                    Rectangle rectangle2 = new Rectangle(0, 0, base.ClientRectangle.Width - 1, 0);
                    List<slider_item>.Enumerator enumerator2 = this.m_slider_items.GetEnumerator();
                    try
                    {
                        while (enumerator2.MoveNext())
                        {
                            enumerator2.get_Current();
                            MeasureItemEventArgs args2 = new MeasureItemEventArgs(null, index, 0x1a);
                            this.on_measure_item(args2);
                            num3 += args2.ItemHeight;
                            rectangle2.Height = args2.ItemHeight;
                            rectangle2.Offset(0, rectangle2.Height);
                            index++;
                        }
                    }
                    finally
                    {
                        enumerator2.Dispose();
                    }
                    this.m_item_window_rect.Location = new Point((base.Location.X + base.ClientRectangle.Left) + 1, ((base.Location.Y + base.ClientRectangle.Top) + 1) + num3);
                    this.m_item_window_rect.Size = new Size(base.ClientRectangle.Width - 2, (num3 < (base.ClientRectangle.Height - 2)) ? ((base.ClientRectangle.Height - 2) - num3) : 0);
                }
                this.update_item_window_pos();
            }
        }

        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);
        }

        protected void do_paint()
        {
            using (Graphics g = Graphics.FromHwndInternal(base.Handle))
            {
                this.do_paint(g);
            }
        }

        protected void do_paint(Graphics g)
        {
            if ((0 < base.ClientRectangle.Height) && (0 < base.ClientRectangle.Width))
            {
                using (Bitmap image = new Bitmap(base.ClientRectangle.Width, base.ClientRectangle.Height))
                {
                    Region region = null;
                    using (Graphics context = Graphics.FromImage(image))
                    {
                        using (Brush brush = new SolidBrush(this.m_clr_background))
                        {
                            context.FillRectangle(brush, 0, 0, image.Width, image.Height);
                        }
                        this.browse_item_by_pos(new browse_item_handler(this.on_paint_helper), context, context);
                        using (Pen pen = new Pen(this.m_clr_frame))
                        {
                            context.DrawRectangle(pen, 0, 0, image.Width - 1, image.Height - 1);
                        }
                        if ((0 <= this.m_selected_index) && (this.m_slider_items.get_Count() > this.m_selected_index))
                        {
                            Control window = this.m_slider_items.get_Item(this.m_selected_index).window;
                            if (window != null)
                            {
                                region = window.Region;
                                if (region == null)
                                {
                                    Rectangle rect = this.m_item_window_rect;
                                    rect.Offset(-base.Location.X, -base.Location.Y);
                                    region = new Region(rect);
                                    g.ExcludeClip(region);
                                }
                                else
                                {
                                    g.ExcludeClip(region);
                                }
                            }
                        }
                    }
                    g.DrawImage(image, base.ClientRectangle);
                    if (region != null)
                    {
                        g.SetClip(region, CombineMode.Union);
                        region.Dispose();
                    }
                }
            }
        }

        public void insert_slider(int index, string name, string prompt, object img, Control window)
        {
            if ((0 <= index) && (index <= this.m_slider_items.get_Count()))
            {
                slider_item _item = new slider_item(name, prompt, img, window);
                _item.m_host = this;
                this.m_slider_items.Insert(index, _item);
                this.select_slider(index);
            }
        }

        public void insert_slider(int index, string name, string prompt, object img, Control window, int pane_height)
        {
            if ((0 <= index) && (index <= this.m_slider_items.get_Count()))
            {
                slider_item _item = new slider_item(name, prompt, img, window, pane_height);
                _item.m_host = this;
                this.m_slider_items.Insert(index, _item);
                this.select_slider(index);
            }
        }

        protected virtual void on_draw_item(DrawItemEventArgs e)
        {
            Rectangle rect;
            if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
            {
                if ((e.State & DrawItemState.HotLight) == DrawItemState.HotLight)
                {
                    using (LinearGradientBrush brush = new LinearGradientBrush(e.Bounds, this.m_clr_toggleditem_top, this.m_clr_toggleditem_bottom, LinearGradientMode.Vertical))
                    {
                        e.Graphics.FillRectangle(brush, e.Bounds);
                        goto Label_010A;
                    }
                }
                using (LinearGradientBrush brush2 = new LinearGradientBrush(e.Bounds, this.m_clr_selecteditem_top, this.m_clr_selecteditem_bottom, LinearGradientMode.Vertical))
                {
                    e.Graphics.FillRectangle(brush2, e.Bounds);
                    goto Label_010A;
                }
            }
            if ((e.State & DrawItemState.HotLight) == DrawItemState.HotLight)
            {
                using (LinearGradientBrush brush3 = new LinearGradientBrush(e.Bounds, this.m_clr_hotitem_top, this.m_clr_hotitem_bottom, LinearGradientMode.Vertical))
                {
                    e.Graphics.FillRectangle(brush3, e.Bounds);
                    goto Label_010A;
                }
            }
            using (LinearGradientBrush brush4 = new LinearGradientBrush(e.Bounds, this.m_clr_item_top, this.m_clr_item_bottom, LinearGradientMode.Vertical))
            {
                e.Graphics.FillRectangle(brush4, e.Bounds);
            }
        Label_010A:
            rect = new Rectangle(e.Bounds.Left + this.m_item_padding, e.Bounds.Top + this.m_item_padding, e.Bounds.Height - (this.m_item_padding * 2), e.Bounds.Height - (this.m_item_padding * 2));
            slider_item _item = this.m_slider_items.get_Item(e.Index);
            if (_item.image != null)
            {
                if (_item.image is Image)
                {
                    e.Graphics.DrawImage((Image) _item.image, rect);
                }
                else if (_item.image is Icon)
                {
                    e.Graphics.DrawIcon((Icon) _item.image, rect);
                }
            }
            Rectangle layoutRectangle = Rectangle.FromLTRB((_item.image != null) ? (rect.Right + this.m_item_padding) : (e.Bounds.Left + this.m_item_padding), rect.Top, e.Bounds.Right - this.m_item_padding, rect.Bottom);
            StringFormat format = new StringFormat();
            format.Alignment = StringAlignment.Near;
            format.LineAlignment = StringAlignment.Center;
            format.HotkeyPrefix = HotkeyPrefix.Show;
            format.Trimming = StringTrimming.EllipsisWord;
            format.FormatFlags = StringFormatFlags.NoWrap;
            using (Font font = new Font(this.Font, FontStyle.Bold))
            {
                using (SolidBrush brush5 = new SolidBrush(this.m_clr_text))
                {
                    e.Graphics.DrawString(_item.name, font, brush5, layoutRectangle, format);
                }
            }
            using (Pen pen = new Pen(this.m_clr_frame))
            {
                e.Graphics.DrawRectangle(pen, e.Bounds);
            }
            if ((e.State & DrawItemState.Focus) == DrawItemState.Focus)
            {
                ControlPaint.DrawFocusRectangle(e.Graphics, new Rectangle(e.Bounds.Left + 2, e.Bounds.Top + 2, e.Bounds.Width - 3, e.Bounds.Height - 3));
            }
        }

        protected virtual void on_measure_item(MeasureItemEventArgs e)
        {
        }

        protected void on_mouse_down_helper(browse_item_helper_arg e)
        {
            MouseEventArgs context = (MouseEventArgs) e.context;
            if (e.item_rect.Contains(context.get_Location()))
            {
                e.hitted = true;
                if (MouseButtons.Left == context.Button)
                {
                    this.m_toggled_index = e.index;
                    this.m_focus_index = e.index;
                    this.do_paint();
                }
                e.cancel = true;
            }
        }

        protected void on_mouse_move_helper(browse_item_helper_arg e)
        {
            MouseEventArgs context = (MouseEventArgs) e.context;
            if (e.item_rect.Contains(context.get_Location()))
            {
                e.hitted = true;
                if (this.m_hot_index != e.index)
                {
                    this.m_hot_index = e.index;
                    this.do_paint();
                    e.cancel = true;
                }
            }
        }

        protected void on_mouse_up_helper(browse_item_helper_arg e)
        {
            MouseEventArgs context = (MouseEventArgs) e.context;
            if (e.item_rect.Contains(context.get_Location()))
            {
                e.hitted = true;
                if ((e.index == this.m_toggled_index) && (MouseButtons.Left == context.Button))
                {
                    this.m_toggled_index = -1;
                    this.select_slider(e.index);
                }
                e.cancel = true;
            }
        }

        protected void on_paint_helper(browse_item_helper_arg e)
        {
            DrawItemState none = DrawItemState.None;
            none |= DrawItemState.Default;
            if (e.index == this.m_selected_index)
            {
                none |= DrawItemState.Selected;
            }
            if (e.index == this.m_hot_index)
            {
                none |= DrawItemState.HotLight;
            }
            if ((e.index == this.m_focus_index) && this.Focused)
            {
                none |= DrawItemState.Focus;
            }
            if (e.index == this.m_toggled_index)
            {
                none |= DrawItemState.HotLight | DrawItemState.Selected;
            }
            DrawItemEventArgs args = new DrawItemEventArgs((Graphics) e.context, this.Font, e.item_rect, e.index, none);
            this.on_draw_item(args);
        }

        protected override void OnGotFocus(EventArgs e)
        {
            this.do_paint();
            base.OnGotFocus(e);
        }

        protected override void OnKeyDown(KeyEventArgs e)
        {
            if (((Keys.Return == e.KeyCode) || (Keys.Space == e.KeyCode)) && (-1 != this.m_focus_index))
            {
                this.m_toggled_index = this.m_focus_index;
                this.do_paint();
            }
            base.OnKeyDown(e);
        }

        protected override void OnKeyUp(KeyEventArgs e)
        {
            if ((Keys.Return == e.KeyCode) || (Keys.Space == e.KeyCode))
            {
                this.m_toggled_index = -1;
                this.select_slider(this.m_focus_index);
            }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -