当前位置: 首页>>代码示例>>C#>>正文


C# LinearGradientBrush.Dispose方法代码示例

本文整理汇总了C#中LinearGradientBrush.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# LinearGradientBrush.Dispose方法的具体用法?C# LinearGradientBrush.Dispose怎么用?C# LinearGradientBrush.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LinearGradientBrush的用法示例。


在下文中一共展示了LinearGradientBrush.Dispose方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnPaint

    void OnPaint(object sender, PaintEventArgs e)
    {
        Graphics g = e.Graphics;

        Point pt1 = new Point(5, 5);
        Point pt2 = new Point(25, 25);
        Brush lg = new LinearGradientBrush(pt1, pt2, Color.Red, Color.Black);
        g.FillRectangle(lg, 20, 20, 300, 40);

        pt1 = new Point(5, 25);
        pt2 = new Point(20, 2);
        lg = new LinearGradientBrush(pt1, pt2, Color.Yellow, Color.Black);
        g.FillRectangle(lg, 20, 80, 300, 40);

        pt1 = new Point(5, 25);
        pt2 = new Point(2, 2);
        lg = new LinearGradientBrush(pt1, pt2, Color.Green, Color.Black);
        g.FillRectangle(lg, 20, 140, 300, 40);

        pt1 = new Point(25, 25);
        pt2 = new Point(15, 25);
        lg = new LinearGradientBrush(pt1, pt2, Color.Blue, Color.Black);
        g.FillRectangle(lg, 20, 200, 300, 40);

        pt1 = new Point(0, 10);
        pt2 = new Point(0, 20);
        lg = new LinearGradientBrush(pt1, pt2, Color.Orange, Color.Black);
        g.FillRectangle(lg, 20, 260, 300, 40);

        lg.Dispose();
        g.Dispose();
    }
开发者ID:sciruela,项目名称:MonoWinformsTutorial,代码行数:32,代码来源:gradients.cs

示例2: PaintDocumentGradientBackground

            public static void PaintDocumentGradientBackground(Graphics graphics, Rectangle rectangle)
            {
                LinearGradientBrush BackgroundBrush = new LinearGradientBrush(rectangle, DefaultGradientUpper, DefaultGradientLower, LinearGradientMode.Vertical);

                graphics.Clear(DefaultGradientUpper);
                graphics.FillRectangle(BackgroundBrush, rectangle);
                BackgroundBrush.Dispose();
            }
开发者ID:ArchangelNexus,项目名称:Abstract-Design-Utility,代码行数:8,代码来源:StyleHelper.cs

示例3: PaintBackground

            public static void PaintBackground(Graphics graphics, Rectangle rectangle, Color colorLight, Color colorDark, Blend blend)
            {
                LinearGradientBrush BackgroundBrush = new LinearGradientBrush(rectangle, colorLight, colorDark, LinearGradientMode.Vertical);

                if (blend != null)
                {
                    BackgroundBrush.Blend = blend;
                }

                graphics.FillRectangle(BackgroundBrush, rectangle);
                BackgroundBrush.Dispose();
            }
开发者ID:ArchangelNexus,项目名称:Abstract-Design-Utility,代码行数:12,代码来源:StyleHelper.cs

示例4: CreateShade

    private void CreateShade()
    {
        if (Shade != null)
        {
            for (int I = 0; I <= Shade.Length - 1; I++)
            {
                Shade[I].Dispose();
            }
        }

        Bitmap ShadeImage = new Bitmap(1, 20);
        Graphics ShadeGraphics = Graphics.FromImage(ShadeImage);

        Rectangle ShadeBounds = new Rectangle(0, 0, 1, 20);
        LinearGradientBrush Gradient = new LinearGradientBrush(ShadeBounds, GetColor("Shade1"), GetColor("Shade2"), 90f);

        Shade = new Pen[20];
        ShadeGraphics.FillRectangle(Gradient, ShadeBounds);

        for (int I = 0; I <= Shade.Length - 1; I++)
        {
            Shade[I] = new Pen(ShadeImage.GetPixel(0, I));
        }

        Gradient.Dispose();
        ShadeGraphics.Dispose();
        ShadeImage.Dispose();
    }
开发者ID:burber,项目名称:APBEMUPANEL,代码行数:28,代码来源:Theme.cs


注:本文中的LinearGradientBrush.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。