本文整理汇总了C#中System.Windows.Media.Drawing.AddRegionShading方法的典型用法代码示例。如果您正苦于以下问题:C# Drawing.AddRegionShading方法的具体用法?C# Drawing.AddRegionShading怎么用?C# Drawing.AddRegionShading使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Drawing
的用法示例。
在下文中一共展示了Drawing.AddRegionShading方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
/// <summary>
/// Draw the shaded region as an approximated polygon and return the polygon
/// The Zindex, Top, and Left attributes will also be set and the shading will be added to the drawing.
/// </summary>
/// <param name="drawing">The current drawing</param>
/// <param name="shadingBrush">The brush to shade the region with</param>
/// <returns>The graphical representation of the region.</returns>
public UIElement Draw(Drawing drawing, Brush shadingBrush)
{
//Create the polygon with the correct physical points
Shading = new System.Windows.Shapes.Polygon();
SetPolygonPoints(Shading, drawing.CoordinateSystem);
//Color the polygon
Shading.Fill = shadingBrush;
Shading.Stroke = new SolidColorBrush(Colors.DarkGray);
Shading.StrokeThickness = 1;
//Orient the polygon
Canvas.SetTop(Shading, 0);
Canvas.SetLeft(Shading, 0);
Canvas.SetZIndex(Shading, (int)ZOrder.Shading);
//Add to the drawing
drawing.AddRegionShading(this);
return Shading;
}