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

📄 listbox_drawer_base.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Pc.BizControls
{
    using System;
    using System.Collections.Generic;
    using System.Drawing;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;

    public abstract class listbox_drawer_base
    {
        protected Color m_border_color = Color.Gray;
        protected DrawMode m_drawmode = DrawMode.OwnerDrawVariable;
        protected Font m_font = SystemFonts.get_DefaultFont();
        protected Dictionary<listbox_widget, bool> m_hosts = new Dictionary<listbox_widget, bool>();

        public abstract void draw_background(listbox_widget host, Graphics g);
        public abstract void draw_host_item(listbox_widget host, DrawItemEventArgs e);
        public abstract bool get_item_text(listbox_widget host, int index, out string text);
        public abstract bool get_item_tooltip(listbox_widget host, int index, out string tooltip);
        public void invalidate_host(listbox_widget host)
        {
            if (host != null)
            {
                IntPtr handle = host.Handle;
                host.Invalidate();
            }
        }

        protected void invalidate_hosts()
        {
            if (this.m_hosts != null)
            {
                Dictionary<listbox_widget, bool>.Enumerator enumerator = this.m_hosts.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    IntPtr handle = enumerator.get_Current().get_Key().Handle;
                    enumerator.get_Current().get_Key().Invalidate();
                }
            }
        }

        public abstract void measure_host_item(listbox_widget host, MeasureItemEventArgs e);
        public bool register(listbox_widget listbox)
        {
            if (listbox == null)
            {
                return false;
            }
            this.m_hosts.set_Item(listbox, true);
            listbox.DrawMode = this.m_drawmode;
            this.invalidate_host(listbox);
            return true;
        }

        public void unregister(listbox_widget listbox)
        {
            this.m_hosts.Remove(listbox);
        }

        public Color border_color
        {
            get
            {
                return this.m_border_color;
            }
            set
            {
                this.m_border_color = value;
                this.invalidate_hosts();
            }
        }

        public DrawMode drawmode
        {
            get
            {
                return this.m_drawmode;
            }
            set
            {
                if (this.m_drawmode != value)
                {
                    this.m_drawmode = value;
                    Dictionary<listbox_widget, bool>.Enumerator enumerator = this.m_hosts.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        enumerator.get_Current().get_Key().DrawMode = this.m_drawmode;
                    }
                }
            }
        }

        public Font font
        {
            get
            {
                return this.m_font;
            }
            set
            {
                if (value != null)
                {
                    this.m_font = value;
                    this.invalidate_hosts();
                }
            }
        }
    }
}

⌨️ 快捷键说明

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