本文整理汇总了C#中System.Drawing.Drawing2D.Blend.Factors属性的典型用法代码示例。如果您正苦于以下问题:C# Blend.Factors属性的具体用法?C# Blend.Factors怎么用?C# Blend.Factors使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类System.Drawing.Drawing2D.Blend
的用法示例。
在下文中一共展示了Blend.Factors属性的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DemonstrateBlend
private void DemonstrateBlend(PaintEventArgs e)
{
Blend blend1 = new Blend(9);
// Set the values in the Factors array to be all green,
// go to all blue, and then go back to green.
blend1.Factors = new float[]{0.0F, 0.2F, 0.5F, 0.7F, 1.0F,
0.7F, 0.5F, 0.2F, 0.0F};
// Set the positions.
blend1.Positions =
new float[]{0.0F, 0.1F, 0.3F, 0.4F, 0.5F, 0.6F,
0.7F, 0.8F, 1.0F};
// Declare a rectangle to draw the Blend in.
Rectangle rectangle1 = new Rectangle(10, 10, 120, 100);
// Create a new LinearGradientBrush using the rectangle,
// green and blue. and 90-degree angle.
LinearGradientBrush brush1 =
new LinearGradientBrush(rectangle1, Color.LightGreen,
Color.Blue, 90, true);
// Set the Blend property on the brush to the custom blend.
brush1.Blend = blend1;
// Fill in an ellipse with the brush.
e.Graphics.FillEllipse(brush1, rectangle1);
// Dispose of the custom brush.
brush1.Dispose();
}