本文整理汇总了C#中LinearGradientBrush.SetSigmaBellShape方法的典型用法代码示例。如果您正苦于以下问题:C# LinearGradientBrush.SetSigmaBellShape方法的具体用法?C# LinearGradientBrush.SetSigmaBellShape怎么用?C# LinearGradientBrush.SetSigmaBellShape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LinearGradientBrush
的用法示例。
在下文中一共展示了LinearGradientBrush.SetSigmaBellShape方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawTab
public static void DrawTab(Graphics g, Rectangle r, Corners corner, GradientType gradient, Color darkColor, Color lightColor, Color edgeColor, bool closed)
{
//dims
Point[] points;
GraphicsPath path;
Region Region;
LinearGradientBrush linearBrush;
Brush brush = null;
Pen pen;
r.Inflate(- 1, - 1);
//set brushes
switch (gradient)
{
case GradientType.Flat:
brush = new SolidBrush(darkColor);
break;
case GradientType.Linear:
brush = new LinearGradientBrush(r, darkColor, lightColor, LinearGradientMode.Vertical);
break;
case GradientType.Bell:
linearBrush = new LinearGradientBrush(r, darkColor, lightColor, LinearGradientMode.Vertical);
linearBrush.SetSigmaBellShape((float) (0.17F), (float) (0.67F));
brush = linearBrush;
break;
}
pen = new pen(edgeColor, 1);
//generic points
points = new Point[12] {new Point(r.Left, r.Bottom), new Point(r.Left, r.Bottom - bshift), new Point(r.Left, r.Top + bshift), new Point(r.Left, r.Top), new Point(r.Left + bshift, r.Top), new Point(r.Right - bshift, r.Top), new Point(r.Right, r.Top), new Point(r.Right, r.Top + bshift), new Point(r.Right, r.Bottom - bshift), new Point(r.Right, r.Bottom), new Point(r.Right - bshift, r.Bottom), new Point(r.Left + bshift, r.Bottom)};
path = new GraphicsPath();
switch (corner)
{
case Corners.LeftBottom:
path.AddLine(points[3], points[1]);
path.AddBezier(points[1], points[0], points[0], points[11]);
path.AddLine(points[11], points[9]);
path.AddLine(points[9], points[6]);
path.AddLine(points[6], points[3]);
Region = new Region(path);
g.FillRegion(brush, Region);
g.DrawLine(pen, points[3], points[1]);
g.DrawBezier(pen, points[1], points[0], points[0], points[11]);
g.DrawLine(pen, points[11], points[9]);
g.DrawLine(pen, points[9], points[6]);
if (closed)
{
g.DrawLine(pen, points[6], points[3]);
}
break;
case Corners.LeftTop:
path.AddLine(points[0], points[2]);
path.AddBezier(points[2], points[3], points[3], points[4]);
path.AddLine(points[4], points[6]);
path.AddLine(points[6], points[9]);
path.AddLine(points[9], points[0]);
Region = new Region(path);
g.FillRegion(brush, Region);
g.DrawLine(pen, points[0], points[2]);
g.DrawBezier(pen, points[2], points[3], points[3], points[4]);
g.DrawLine(pen, points[4], points[6]);
g.DrawLine(pen, points[6], points[9]);
if (closed)
{
g.DrawLine(pen, points[9], points[0]);
}
break;
case Corners.Bottom:
path.AddLine(points[1], points[3]);
path.AddBezier(points[1], points[0], points[0], points[11]);
path.AddLine(points[11], points[10]);
path.AddBezier(points[10], points[9], points[9], points[8]);
path.AddLine(points[8], points[6]);
path.AddLine(points[6], points[3]);
Region = new Region(path);
g.FillRegion(brush, Region);
g.DrawLine(pen, points[1], points[3]);
g.DrawBezier(pen, points[1], points[0], points[0], points[11]);
g.DrawLine(pen, points[11], points[10]);
g.DrawBezier(pen, points[10], points[9], points[9], points[8]);
g.DrawLine(pen, points[8], points[6]);
if (closed)
{
g.DrawLine(pen, points[6], points[3]);
}
break;
case Corners.Top:
path.AddLine(points[0], points[2]);
path.AddBezier(points[2], points[3], points[3], points[4]);
path.AddLine(points[4], points[5]);
path.AddBezier(points[5], points[6], points[6], points[7]);
path.AddLine(points[7], points[9]);
path.AddLine(points[9], points[0]);
Region = new Region(path);
g.FillRegion(brush, Region);
//.........这里部分代码省略.........