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