本文整理匯總了C#中System.Drawing.Drawing2D.PathGradientBrush.SetBlendTriangularShape方法的典型用法代碼示例。如果您正苦於以下問題:C# PathGradientBrush.SetBlendTriangularShape方法的具體用法?C# PathGradientBrush.SetBlendTriangularShape怎麽用?C# PathGradientBrush.SetBlendTriangularShape使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Drawing.Drawing2D.PathGradientBrush
的用法示例。
在下文中一共展示了PathGradientBrush.SetBlendTriangularShape方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: gradient
public void gradient(Point[] points, PathGradientBrush pgbrush, Triangle tre, GraphicsPath brushPath)
{
Color[] mySurroundColor = { tre.v1.currColor, tre.v2.currColor, tre.v3.currColor};
pgbrush.SurroundColors = mySurroundColor;
int averageR = (tre.v1.currColor.R + tre.v2.currColor.R + tre.v3.currColor.R) / 3;
int averageG = (tre.v1.currColor.G + tre.v2.currColor.G + tre.v3.currColor.G) / 3;
int averageB = (tre.v1.currColor.B + tre.v2.currColor.B + tre.v3.currColor.B) / 3;
Color centerCol = Color.FromArgb((byte) averageR, (byte)averageG, (byte)averageB);
pgbrush.CenterColor = centerCol;
pgbrush.SetBlendTriangularShape(0.7f, 0.7f);
graphics.FillPolygon(pgbrush, points);
pgbrush.Dispose();
}
示例2: DrawMenuButtonDropShadow
/// <summary>
/// Draw a gradient shadow effect
/// </summary>
private void DrawMenuButtonDropShadow(Graphics g, RectangleF bounds, int depth, int opacity)
{
// offset shadow dimensions
RectangleF shadowBounds = bounds;
shadowBounds.Inflate(1, 1);
shadowBounds.Offset(depth, depth);
// create a clipping region
bounds.Inflate(1, 1);
using (GraphicsPath clipPath = CreateRoundRectanglePath(
g,
bounds.X, bounds.Y,
bounds.Width, bounds.Height,
CornerRadius))
{
// clip the interior
using (Region region = new Region(clipPath))
g.SetClip(region, CombineMode.Exclude);
}
// create a graphics path
using (GraphicsPath gp = CreateRoundRectanglePath(g, shadowBounds.X, shadowBounds.Y,
shadowBounds.Width, shadowBounds.Height, 8))
{
// draw with a path brush
using (PathGradientBrush borderBrush = new PathGradientBrush(gp))
{
borderBrush.CenterColor = Color.FromArgb(opacity, Color.Black);
borderBrush.SurroundColors = new Color[] { Color.Transparent };
borderBrush.SetBlendTriangularShape(.5f, 1.0f);
borderBrush.FocusScales = new PointF(.4f, .5f);
g.FillPath(borderBrush, gp);
g.ResetClip();
}
}
}
示例3: SetBlendTriangularShape_ScaleTooBig
public void SetBlendTriangularShape_ScaleTooBig ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.SetBlendTriangularShape (1, 1.01f);
}
}
示例4: SetBlendTriangularShape_FocusTooSmall
public void SetBlendTriangularShape_FocusTooSmall ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
pgb.SetBlendTriangularShape (-1);
}
}
示例5: SetBlendTriangularShape_Scale
public void SetBlendTriangularShape_Scale ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.Clamp)) {
// max valid
pgb.SetBlendTriangularShape (0, 1);
Assert.IsTrue (pgb.Transform.IsIdentity, "Transform.IsIdentity-1");
// min valid
pgb.SetBlendTriangularShape (1, 0);
Assert.IsTrue (pgb.Transform.IsIdentity, "Transform.IsIdentity-1");
// middle
pgb.SetBlendTriangularShape (0.5f, 0.5f);
Assert.IsTrue (pgb.Transform.IsIdentity, "Transform.IsIdentity-1");
// no impact on matrix
}
}
示例6: Rectangle
public void Rectangle ()
{
using (PathGradientBrush pgb = new PathGradientBrush (pts_2f, WrapMode.TileFlipXY)) {
CheckDefaultRectangle ("Original", pgb.Rectangle);
pgb.MultiplyTransform (new Matrix (2, 0, 0, 2, 2, 2));
CheckDefaultRectangle ("Multiply", pgb.Rectangle);
pgb.ResetTransform ();
CheckDefaultRectangle ("Reset", pgb.Rectangle);
pgb.RotateTransform (90);
CheckDefaultRectangle ("Rotate", pgb.Rectangle);
pgb.ScaleTransform (4, 0.25f);
CheckDefaultRectangle ("Scale", pgb.Rectangle);
pgb.TranslateTransform (-10, -20);
CheckDefaultRectangle ("Translate", pgb.Rectangle);
pgb.SetBlendTriangularShape (0.5f);
CheckDefaultRectangle ("SetBlendTriangularShape", pgb.Rectangle);
pgb.SetSigmaBellShape (0.5f);
CheckDefaultRectangle ("SetSigmaBellShape", pgb.Rectangle);
}
}