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

📄 defaultdrawer.cs

📁 破解的飞信源代码
💻 CS
字号:
namespace Imps.Client.Pc.XControls
{
    using System;
    using System.Drawing;

    public class DefaultDrawer : IXTabDrawer
    {
        public void DrawBorder(Graphics g, XTabControl xTab)
        {
            if (xTab.TabRectangle == Rectangle.Empty)
            {
                using (SolidBrush brush = new SolidBrush(xTab.BorderColor))
                {
                    using (Pen pen = new Pen(brush, (float) xTab.BorderWidth))
                    {
                        g.DrawRectangle(pen, xTab.ClientRectangle.X, xTab.ClientRectangle.Y, xTab.ClientRectangle.Width - (2 * xTab.BorderWidth), xTab.ClientRectangle.Height - xTab.BorderWidth);
                    }
                    return;
                }
            }
            int x = xTab.ClientRectangle.X;
            int y = xTab.ClientRectangle.Y;
            int width = xTab.ClientRectangle.Width;
            int height = xTab.ClientRectangle.Height;
            int tabHeight = xTab.TabHeight;
            int borderWidth = xTab.BorderWidth;
            Rectangle tabRectangle = xTab.TabPages[xTab.SelectedIndex].TabRectangle;
            using (SolidBrush brush2 = new SolidBrush(xTab.BorderColor))
            {
                using (Pen pen2 = new Pen(brush2, (float) xTab.BorderWidth))
                {
                    Point[] points = new Point[] { new Point(tabRectangle.X, tabRectangle.Y + tabHeight), new Point(x, y + tabHeight), new Point(x, (y + height) - borderWidth), new Point((x + width) - (2 * borderWidth), (y + height) - borderWidth), new Point((x + width) - (2 * borderWidth), y + tabHeight), new Point(tabRectangle.X + tabRectangle.Width, tabRectangle.Y + tabHeight) };
                    g.DrawLines(pen2, points);
                }
            }
        }

        public void DrawScrollButton(Graphics g, XTabControl xTab)
        {
            xTab.ScrollRectA = Rectangle.Empty;
            xTab.ScrollRectB = Rectangle.Empty;
        }

        public void DrawTabs(Graphics g, XTabControl xTab)
        {
            if (xTab.TabRectangle != Rectangle.Empty)
            {
                using (Brush brush = new SolidBrush(xTab.BorderColor))
                {
                    using (Brush brush2 = new SolidBrush(xTab.SelectedTabBackColor))
                    {
                        using (Brush brush3 = new SolidBrush(xTab.HoverTabBackColor))
                        {
                            using (Brush brush4 = new SolidBrush(Color.Black))
                            {
                                using (Pen pen = new Pen(brush))
                                {
                                    using (Font font = new Font("宋体", 9f))
                                    {
                                        int x = xTab.ClientRectangle.X;
                                        int y = xTab.ClientRectangle.Y;
                                        int num = 2;
                                        int num2 = 1;
                                        int num3 = xTab.ClientRectangle.X;
                                        int num4 = xTab.ClientRectangle.Y;
                                        int width = 0;
                                        int height = xTab.TabHeight;
                                        XTabPage page = null;
                                        Image image = null;
                                        Rectangle empty = Rectangle.Empty;
                                        int num7 = 0x10;
                                        int num8 = 0x10;
                                        int num9 = (height - num8) / 2;
                                        int num10 = 0;
                                        int currentOffSet = xTab.CurrentOffSet;
                                        for (int i = 0; i < xTab.TabCount; i++)
                                        {
                                            page = xTab.TabPages[i];
                                            image = page.Image;
                                            if (image != null)
                                            {
                                                width += image.Width + (2 * num2);
                                            }
                                            SizeF ef = g.MeasureString(page.Text, font);
                                            num10 = ((height - Convert.ToInt32(ef.Height)) / 2) + xTab.BorderWidth;
                                            width += Convert.ToInt32(ef.Width);
                                            width += 2 * num;
                                            page.TabRectangle = new Rectangle(num3, num4, width, height);
                                            num3 += width;
                                            width = 0;
                                        }
                                        for (int j = 0; j < xTab.TabCount; j++)
                                        {
                                            page = xTab.TabPages[j];
                                            if (!page.Hided)
                                            {
                                                empty = page.TabRectangle;
                                                image = page.Image;
                                                if (j == xTab.SelectedIndex)
                                                {
                                                    g.FillRectangle(brush2, empty.X + currentOffSet, empty.Y, empty.Width, empty.Height);
                                                }
                                                else if (j == xTab.HoverIndex)
                                                {
                                                    g.FillRectangle(brush3, empty.X + currentOffSet, empty.Y, empty.Width, empty.Height);
                                                }
                                                if (image != null)
                                                {
                                                    num3 = ((((empty.X + num) + num2) + image.Width) + num2) + currentOffSet;
                                                    g.DrawImage(page.Image, (empty.X + (2 * num2)) + currentOffSet, empty.Y + num9, num7, num8);
                                                    g.DrawString(page.Text, font, brush4, (float) (num3 + currentOffSet), (float) (num4 + num10));
                                                }
                                                else
                                                {
                                                    num3 = empty.X + num;
                                                    g.DrawString(page.Text, font, brush4, (float) (num3 + currentOffSet), (float) (num4 + num10));
                                                }
                                            }
                                        }
                                        for (int k = 0; k < xTab.TabCount; k++)
                                        {
                                            page = xTab.TabPages[k];
                                            if (!page.Hided)
                                            {
                                                empty = page.TabRectangle;
                                                g.DrawLine(pen, new Point((empty.X + empty.Width) + currentOffSet, num4), new Point((empty.X + empty.Width) + currentOffSet, num4 + xTab.TabHeight));
                                            }
                                        }
                                        empty = xTab.TabPages[xTab.SelectedIndex].TabRectangle;
                                        Point[] points = new Point[] { new Point(empty.X + currentOffSet, empty.Y + height), new Point(empty.X + currentOffSet, empty.Y), new Point((empty.X + empty.Width) + currentOffSet, empty.Y) };
                                        g.DrawLines(pen, points);
                                    }
                                    return;
                                }
                            }
                        }
                    }
                }
            }
            for (int m = 0; m < xTab.TabCount; m++)
            {
                xTab.TabPages[m].TabRectangle = Rectangle.Empty;
            }
        }
    }
}

⌨️ 快捷键说明

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