本文整理汇总了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();
}
示例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();
}
示例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();
}
示例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();
}