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

📄 drawhelper.cs

📁 破解的飞信源代码
💻 CS
📖 第 1 页 / 共 2 页
字号:
                    g.FillRectangle(brush, rect.Right + num2, rect.Top + num2, 1, rect.Height);
                }
                num2++;
            }
        }

        public static void DrawRoundRect(Graphics g, Rectangle rect, int roundSize, Color penColor)
        {
            DrawAndFillRoundRect(g, rect, roundSize, Color.Transparent, penColor, 0);
        }

        public static void DrawStrechImage(Graphics g, Image image, Rectangle rect)
        {
            DrawStrechImage(g, image, rect, false);
        }

        public static void DrawStrechImage(Graphics g, Image image, Rectangle rect, bool bBottom)
        {
            if (bBottom)
            {
                int width = rect.Width;
                int num2 = image.Width;
                int y = rect.Y;
                int x = rect.X;
                int height = image.Height;
                for (int i = 0; i < width; i += num2)
                {
                    int num7 = num2;
                    if ((i + num2) >= width)
                    {
                        num7 = width - i;
                    }
                    g.DrawImage(image, new Rectangle(x + i, y, num7, height));
                }
            }
            else
            {
                int num8 = rect.Width;
                int num9 = image.Width;
                int num10 = rect.Y;
                int num11 = rect.X;
                int num1 = image.Height;
                for (int j = 0; j < num8; j += num9)
                {
                    int num13 = num9;
                    if ((j + num9) >= num8)
                    {
                        num13 = num8 - j;
                    }
                    g.DrawImage(image, new Rectangle(num11 + j, num10, num13, rect.Height));
                }
            }
        }

        public static void DrawStretchBitmap(Graphics g, Bitmap bmp, int x, int y, int w, int h)
        {
            if ((bmp != null) && ((w > 0) && (h > 0)))
            {
                Brush brush = new TextureBrush(bmp, WrapMode.Tile, new Rectangle(0, 0, bmp.Width, bmp.Height));
                Bitmap image = new Bitmap(w, h);
                Graphics.FromImage(image).FillRectangle(brush, 0, 0, w, h);
                g.DrawImage(image, x, y);
            }
        }

        public static void DrawString(Graphics g, string s, Rectangle rc, Font font, Brush brush, StringAlignment sa, bool enabled)
        {
            using (StringFormat format = new StringFormat(StringFormatFlags.NoWrap))
            {
                format.HotkeyPrefix = HotkeyPrefix.Show;
                format.Alignment = sa;
                format.LineAlignment = StringAlignment.Center;
                format.Trimming = StringTrimming.EllipsisCharacter;
                if (enabled)
                {
                    g.DrawString(s, font, brush, rc, format);
                }
                else
                {
                    DrawStringDisabled(g, s, rc, font, sa);
                }
            }
        }

        public static void DrawStringDisabled(Graphics g, string s, Rectangle rc, Font font, StringAlignment sa)
        {
            DrawStringDisabled(g, s, rc, font, sa, Color.FromArgb(0x40, 0xff, 0xff, 0xff));
        }

        public static void DrawStringDisabled(Graphics g, string s, Rectangle rc, Font font, StringAlignment sa, Color color)
        {
            using (StringFormat format = new StringFormat(StringFormatFlags.NoWrap))
            {
                format.HotkeyPrefix = HotkeyPrefix.Show;
                format.Alignment = sa;
                format.LineAlignment = StringAlignment.Center;
                format.Trimming = StringTrimming.EllipsisCharacter;
                g.DrawString(s, font, new SolidBrush(Color.FromArgb(0x40, color)), rc, format);
            }
        }

        public static void DrawTriangle(Graphics g, Rectangle rect, Direction direct, Color clr)
        {
            if ((rect.Width != 0) && (rect.Height != 0))
            {
                using (Brush brush = new SolidBrush(clr))
                {
                    float num;
                    float y;
                    float num3;
                    float x;
                    float top;
                    float bottom;
                    switch (direct)
                    {
                        case Direction.Right:
                            num = ((float) rect.Height) / ((float) (rect.Width * 2));
                            y = (rect.Top + rect.Bottom) / 2;
                            num3 = y;
                            x = rect.Right;
                            goto Label_0090;

                        case Direction.Up:
                            num = ((float) rect.Width) / ((float) (rect.Height * 2));
                            y = (rect.Left + rect.Right) / 2;
                            num3 = y;
                            top = rect.Top;
                            goto Label_00FA;

                        case Direction.Down:
                            num = ((float) rect.Width) / ((float) (rect.Height * 2));
                            y = (rect.Left + rect.Right) / 2;
                            num3 = y;
                            bottom = rect.Bottom;
                            goto Label_0164;

                        default:
                            goto Label_0172;
                    }
                Label_006C:
                    g.FillRectangle(brush, x, y, 1f, num3 - y);
                    y -= num;
                    num3 += num;
                    x -= 1f;
                Label_0090:
                    if (x >= rect.Left)
                    {
                        goto Label_006C;
                    }
                    return;
                Label_00D6:
                    g.FillRectangle(brush, y, top, num3 - y, 1f);
                    y -= num;
                    num3 += num;
                    top += 1f;
                Label_00FA:
                    if (top <= rect.Bottom)
                    {
                        goto Label_00D6;
                    }
                    return;
                Label_0140:
                    g.FillRectangle(brush, y, bottom, num3 - y, 1f);
                    y -= num;
                    num3 += num;
                    bottom -= 1f;
                Label_0164:
                    if (bottom >= rect.Top)
                    {
                        goto Label_0140;
                    }
                    return;
                Label_0172:
                    num = ((float) rect.Height) / ((float) (rect.Width * 2));
                    y = (rect.Top + rect.Bottom) / 2;
                    num3 = y;
                    for (float i = rect.Left; i <= rect.Right; i += 1f)
                    {
                        g.FillRectangle(brush, i, y, 1f, num3 - y);
                        y -= num;
                        num3 += num;
                    }
                }
            }
        }

        public static void DrawVerStrechImage(Graphics g, Image image, Rectangle rect)
        {
            DrawVerStrechImage(g, image, rect, false);
        }

        public static void DrawVerStrechImage(Graphics g, Image image, Rectangle rect, bool bRight)
        {
            if (bRight)
            {
                int height = rect.Height;
                int width = image.Width;
                int y = rect.Y;
                int x = rect.X;
                int num5 = image.Height;
                for (int i = 0; i < height; i += num5)
                {
                    int num7 = num5;
                    if ((i + num5) >= height)
                    {
                        num7 = height - i;
                    }
                    g.DrawImage(image, new Rectangle(x, y + i, width, num7));
                }
            }
            else
            {
                int num8 = rect.Height;
                int num9 = image.Width;
                int num10 = rect.Y;
                int num11 = rect.X;
                int num12 = image.Height;
                for (int j = 0; j < num8; j += num12)
                {
                    int num14 = num12;
                    if ((j + num12) >= num8)
                    {
                        num14 = num8 - j;
                    }
                    g.DrawImage(image, new Rectangle(num11, num10 + j, num9, num14));
                }
            }
        }

        public static void FillRect(Graphics g, Rectangle rect, Color color)
        {
            using (SolidBrush brush = new SolidBrush(color))
            {
                g.FillRectangle(brush, rect);
            }
        }
    }
}

⌨️ 快捷键说明

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