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

📄 scroll_widget.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 5 页
字号:
namespace Imps.Client.Pc.BizControls
{
    using Imps.Client.Utils;
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Drawing.Drawing2D;
    using System.Runtime.InteropServices;
    using System.Text;
    using System.Windows.Forms;

    public abstract class scroll_widget : Control
    {
        protected DrawItemState m_back_arrow_state = DrawItemState.Inactive;
        private Color m_clr_active_arrow = Color.FromArgb(0xff, 0x48, 0x60, 0xa8);
        private Color m_clr_active_arrow_frame = Color.FromArgb(0xff, 0x4a, 0x95, 0xcc);
        private Color m_clr_active_thumb_frame = Color.FromArgb(0xff, 0x4a, 0x95, 0xcc);
        private Color m_clr_arrow = Color.FromArgb(0xff, 0x88, 0x98, 0x98);
        private Color m_clr_begin = Color.FromArgb(0xff, 0xf3, 0xf7, 250);
        private Color m_clr_end = Color.FromArgb(0xff, 0xe2, 0xea, 0xf3);
        private Color m_clr_frame = Color.FromArgb(0xff, 0xe2, 0xea, 0xf3);
        private Color m_clr_hot_begin = Color.FromArgb(0xff, 0xf3, 0xf7, 250);
        private Color m_clr_hot_end = Color.FromArgb(0xff, 0xd0, 0xe8, 0xf5);
        private Color m_clr_thumb_frame = Color.FromArgb(0xff, 0xa8, 0xc1, 0xda);
        private Color m_clr_toggle_begin = Color.FromArgb(0xff, 0xf3, 0xf7, 250);
        private Color m_clr_toggle_end = Color.FromArgb(0xff, 0xac, 0xe7, 0xff);
        private Color m_clr_tunnel = Color.FromArgb(0xff, 0xff, 0xff, 0xff);
        private bool m_cover_host = true;
        private bool m_for_buddytree;
        private bool m_for_pane;
        private bool m_hook_host = true;
        private Control m_host;
        protected int m_last_hit_thumb_pos;
        protected const int m_min_thumb_size = 10;
        protected DrawItemState m_prev_arrow_state = DrawItemState.Inactive;
        protected bool m_sensitive;
        protected Timer m_slide_timer;
        protected Timer m_startup_timer = new Timer();
        protected bool m_stylized_mode;
        protected bool m_thumb_is_visable;
        protected Rectangle m_thumb_rect = Rectangle.FromLTRB(0, 0, 0, 0);
        protected DrawItemState m_thumb_state = DrawItemState.Inactive;
        protected bool m_toggling;
        protected toggleingpos_type m_togglingpos;
        protected DrawItemState m_tunnel_state = DrawItemState.Inactive;
        protected static Dictionary<IntPtr, hostproc_scrolls> ms_host_procscrolls_map = new Dictionary<IntPtr, hostproc_scrolls>();
        protected static win32api_wrapper.wndproc_type ms_host_wndproc = new win32api_wrapper.wndproc_type(scroll_widget.host_wndproc);
        protected static int ms_slide_interval = 60;
        protected static int ms_statup_interval = 200;

        public scroll_widget()
        {
            this.m_startup_timer.Interval = ms_statup_interval;
            this.m_startup_timer.Enabled = false;
            this.m_startup_timer.Tick += new EventHandler(this.on_startup_tick);
            this.m_slide_timer = new Timer();
            this.m_slide_timer.Interval = ms_slide_interval;
            this.m_slide_timer.Enabled = false;
            this.m_slide_timer.Tick += new EventHandler(this.on_slide_tick);
        }

        protected void calculate_arrows_rect(ref Rectangle rcPrevArrow, ref Rectangle rcBackArrow)
        {
            if (this.vertical)
            {
                int systemMetrics = win32api_wrapper.GetSystemMetrics(20);
                if ((systemMetrics * 2) > base.ClientRectangle.Height)
                {
                    systemMetrics = base.ClientRectangle.Height / 2;
                }
                rcPrevArrow = Rectangle.FromLTRB(base.ClientRectangle.Left, base.ClientRectangle.Top, base.ClientRectangle.Right, base.ClientRectangle.Top + systemMetrics);
                rcBackArrow = Rectangle.FromLTRB(base.ClientRectangle.Left, base.ClientRectangle.Bottom - systemMetrics, base.ClientRectangle.Right, base.ClientRectangle.Bottom);
            }
            else
            {
                int num2 = win32api_wrapper.GetSystemMetrics(10);
                if ((num2 * 2) > base.ClientRectangle.Width)
                {
                    num2 = base.ClientRectangle.Width / 2;
                }
                rcPrevArrow = Rectangle.FromLTRB(base.ClientRectangle.Left, base.ClientRectangle.Top, base.ClientRectangle.Left + num2, base.ClientRectangle.Bottom);
                rcBackArrow = Rectangle.FromLTRB(base.ClientRectangle.Right - num2, base.ClientRectangle.Top, base.ClientRectangle.Right, base.ClientRectangle.Bottom);
            }
        }

        protected void calculate_thumb_rect()
        {
            Rectangle rectangle;
            if (this.m_host != null)
            {
                IntPtr handle = this.m_host.Handle;
            }
            else
            {
                return;
            }
            this.m_thumb_is_visable = false;
            if (this.vertical)
            {
                int systemMetrics = win32api_wrapper.GetSystemMetrics(20);
                int num2 = base.ClientRectangle.Height - (systemMetrics * 2);
                if (0 >= num2)
                {
                    return;
                }
                rectangle = Rectangle.FromLTRB(base.ClientRectangle.Left, base.ClientRectangle.Top + systemMetrics, base.ClientRectangle.Right, base.ClientRectangle.Bottom - systemMetrics);
            }
            else
            {
                int num3 = win32api_wrapper.GetSystemMetrics(0x15);
                int num4 = base.ClientRectangle.Width - (num3 * 2);
                if (0 >= num4)
                {
                    return;
                }
                rectangle = Rectangle.FromLTRB(base.ClientRectangle.Left + num3, base.ClientRectangle.Top, base.ClientRectangle.Right - num3, base.ClientRectangle.Bottom);
            }
            win32api_wrapper.SCROLLINFO si = new win32api_wrapper.SCROLLINFO();
            si.cbSize = 0x1c;
            si.fMask = 0x17;
            win32api_wrapper.GetScrollInfo(this.m_host.Handle, this.vertical ? 1 : 0, ref si);
            if ((si.nMax != 0) && (si.nMax >= si.nPage))
            {
                if (this.vertical)
                {
                    int num5 = (int) ((((double) si.nPage) / ((double) (si.nMax + 1))) * rectangle.Height);
                    if (10 > num5)
                    {
                        num5 = (rectangle.Height < 10) ? rectangle.Height : 10;
                    }
                    int num6 = (int) ((((double) si.nPos) / ((double) ((si.nMax - si.nPage) + 1))) * (rectangle.Height - num5));
                    this.m_thumb_rect = Rectangle.FromLTRB(rectangle.Left, rectangle.Top + num6, rectangle.Right, (rectangle.Top + num6) + num5);
                    this.m_thumb_is_visable = true;
                }
                else
                {
                    int num7 = (int) ((((double) si.nPage) / ((double) (si.nMax + 1))) * rectangle.Width);
                    if (10 > num7)
                    {
                        num7 = (rectangle.Width < 10) ? rectangle.Width : 10;
                    }
                    int num8 = (int) ((((double) si.nPos) / ((double) ((si.nMax - si.nPage) + 1))) * (rectangle.Width - num7));
                    this.m_thumb_rect = Rectangle.FromLTRB(rectangle.Left + num8, rectangle.Top, (rectangle.Left + num8) + num7, rectangle.Bottom);
                    this.m_thumb_is_visable = true;
                }
            }
        }

        protected void click_back_button()
        {
            if (this.m_host != null)
            {
                IntPtr handle = this.m_host.Handle;
            }
            else
            {
                return;
            }
            if (!this.m_hook_host)
            {
                this.on_click_back_button();
            }
            else if (this.vertical)
            {
                win32api_wrapper.SendMessage(this.m_host.Handle, 0x115, (IntPtr) 1, IntPtr.Zero);
            }
            else
            {
                win32api_wrapper.SendMessage(this.m_host.Handle, 0x114, (IntPtr) 1, IntPtr.Zero);
            }
        }

        protected void click_prev_button()
        {
            if (this.m_host != null)
            {
                IntPtr handle = this.m_host.Handle;
            }
            else
            {
                return;
            }
            if (!this.m_hook_host)
            {
                this.on_click_prev_button();
            }
            else if (this.vertical)
            {
                win32api_wrapper.SendMessage(this.m_host.Handle, 0x115, IntPtr.Zero, IntPtr.Zero);
            }
            else
            {
                win32api_wrapper.SendMessage(this.m_host.Handle, 0x114, IntPtr.Zero, IntPtr.Zero);
            }
        }

        protected void click_tunnel(Point pt)
        {
            if (this.m_host != null)
            {
                IntPtr handle = this.m_host.Handle;
            }
            else
            {
                return;
            }
            if (this.m_hook_host)
            {
                if (this.vertical)
                {
                    if (pt.Y < this.m_thumb_rect.Top)
                    {
                        win32api_wrapper.SendMessage(this.m_host.Handle, 0x115, (IntPtr) 2, IntPtr.Zero);
                    }
                    else if (pt.Y > this.m_thumb_rect.Bottom)
                    {
                        win32api_wrapper.SendMessage(this.m_host.Handle, 0x115, (IntPtr) 3, IntPtr.Zero);
                    }
                }
                else if (pt.X < this.m_thumb_rect.Left)
                {
                    win32api_wrapper.SendMessage(this.m_host.Handle, 0x114, (IntPtr) 2, IntPtr.Zero);
                }
                else if (pt.X > this.m_thumb_rect.Right)
                {
                    win32api_wrapper.SendMessage(this.m_host.Handle, 0x114, (IntPtr) 3, IntPtr.Zero);
                }
            }
        }

        protected override void Dispose(bool disposing)
        {
            this.host = null;
            base.Dispose(disposing);
        }

        protected void do_paint()
        {
            if ((base.ClientRectangle.Width > 0) && (base.ClientRectangle.Height > 0))
            {
                try
                {
                    using (Graphics graphics = Graphics.FromHwndInternal(base.Handle))
                    {
                        using (Bitmap image = new Bitmap(base.ClientRectangle.Width, base.ClientRectangle.Height))
                        {
                            Graphics g = Graphics.FromImage(image);
                            this.do_paint(g);
                            graphics.DrawImage(image, base.ClientRectangle);
                        }
                    }
                }
                catch
                {
                }
            }
        }

        protected void do_paint(Graphics g)
        {
            Rectangle rcTunnel = Rectangle.FromLTRB(0, 0, base.ClientRectangle.Width, base.ClientRectangle.Height);
            this.draw_tunnel(g, rcTunnel);
            if (this.vertical)
            {
                int systemMetrics = win32api_wrapper.GetSystemMetrics(20);
                if ((2 * systemMetrics) > rcTunnel.Height)
                {
                    systemMetrics = rcTunnel.Height / 2;
                }
                else
                {
                    int height = rcTunnel.Height;
                }
                this.draw_arrow_button(g, Rectangle.FromLTRB(rcTunnel.Left + 1, rcTunnel.Top + 1, rcTunnel.Right - 2, (rcTunnel.Top + systemMetrics) - 1), draw_tools.arrow_type.top, this.m_prev_arrow_state);
                this.draw_arrow_button(g, Rectangle.FromLTRB(rcTunnel.Left + 1, rcTunnel.Bottom - systemMetrics, rcTunnel.Right - 2, rcTunnel.Bottom - 2), draw_tools.arrow_type.bottom, this.m_back_arrow_state);
            }
            else
            {
                int num2 = win32api_wrapper.GetSystemMetrics(0x15);
                if ((2 * num2) > rcTunnel.Width)
                {
                    num2 = rcTunnel.Width / 2;
                }
                else
                {
                    int width = rcTunnel.Width;
                }
                this.draw_arrow_button(g, Rectangle.FromLTRB(rcTunnel.Left + 1, rcTunnel.Top + 1, (rcTunnel.Left + num2) - 1, rcTunnel.Bottom - 2), draw_tools.arrow_type.left, this.m_prev_arrow_state);
                this.draw_arrow_button(g, Rectangle.FromLTRB(rcTunnel.Right - num2, rcTunnel.Top + 1, rcTunnel.Right - 2, rcTunnel.Bottom - 2), draw_tools.arrow_type.right, this.m_back_arrow_state);
            }
            if (this.m_thumb_is_visable)
            {
                Rectangle rcThumb;
                if (this.vertical)
                {
                    rcThumb = Rectangle.FromLTRB(this.m_thumb_rect.Left + 1, this.m_thumb_rect.Top, this.m_thumb_rect.Right - 2, this.m_thumb_rect.Bottom - 1);
                }
                else
                {
                    rcThumb = Rectangle.FromLTRB(this.m_thumb_rect.Left, this.m_thumb_rect.Top + 1, this.m_thumb_rect.Right - 1, this.m_thumb_rect.Bottom - 2);
                }
                rcThumb.Offset(-base.ClientRectangle.Left, -base.ClientRectangle.Top);
                this.draw_thumb_button(g, rcThumb, this.m_thumb_state);
            }
        }

⌨️ 快捷键说明

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