本文整理匯總了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();
}