Advertisement
Guest User

C# Gradients

a guest
Mar 13th, 2012
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1.         void pbHeaderBar_Paint(object sender, PaintEventArgs e)
  2.         {
  3.             /*
  4.             LinearGradientBrush gradientBrush =
  5.                 new LinearGradientBrush(new Point(0, 0), new Point(0, pbHeaderBar.Height), Color.Black, Color.Black);
  6.  
  7.             ColorBlend colorBlend = new ColorBlend();
  8.             colorBlend.Positions = new float[] { 0, 1/3f, 2/3f, 1 };
  9.             colorBlend.Colors = new Color[] { Color.Blue, Color.Green, Color.Red, Color.Blue };
  10.             gradientBrush.InterpolationColors = colorBlend;
  11.  
  12.             e.Graphics.FillRectangle(gradientBrush, 0, 0, pbHeaderBar.Width, pbHeaderBar.Height);
  13.             */
  14.  
  15.             /*
  16.             Brush gradientBrush = new LinearGradientBrush(new Point(0, 0), new Point(0, pbHeaderBar.Height), Color.Black, Color.Blue);
  17.             e.Graphics.FillRectangle(gradientBrush, 0, 0, pbHeaderBar.Width, pbHeaderBar.Height);
  18.             */
  19.  
  20.             /*
  21.             GraphicsPath gradientPath = new GraphicsPath();
  22.             gradientPath.AddRectangle(new Rectangle(pbHeaderBar.Location, pbHeaderBar.Size));
  23.             PathGradientBrush pathGradientBrush = new PathGradientBrush(gradientPath);
  24.             pathGradientBrush.CenterColor = Color.Green;
  25.             pathGradientBrush.SurroundColors = new[] { Color.Blue };
  26.             e.Graphics.FillRectangle(pathGradientBrush, 0, 0, pbHeaderBar.Width, pbHeaderBar.Height);
  27.             */
  28.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement