本文整理汇总了C#中System.Windows.Media.Brush.Apply方法的典型用法代码示例。如果您正苦于以下问题:C# Brush.Apply方法的具体用法?C# Brush.Apply怎么用?C# Brush.Apply使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Media.Brush
的用法示例。
在下文中一共展示了Brush.Apply方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _getBrushes
private Brush[] _getBrushes(Color C, CornerRadius R) {
if (!_gradientBrushes.ContainsKey(C, R)) {
var brushes = new Brush[9];
brushes[0] = _getRadialBrush(R.TopLeft, new Point(1, 1)); // top-left corner
brushes[1] = _getLinearBrush(new Point(0, 1), new Point(0, 0)); // top edge
brushes[2] = _getRadialBrush(R.TopRight, new Point(0, 1)); // top-right corner
brushes[3] = _getLinearBrush(new Point(1, 0), new Point(0, 0)); // left edge
brushes[4] = new SolidColorBrush(C); // center
brushes[5] = _getLinearBrush(new Point(0, 0), new Point(1, 0)); // right edge
brushes[6] = _getRadialBrush(R.BottomLeft, new Point(1, 0)); // bottom-left corner
brushes[7] = _getLinearBrush(new Point(0, 0), new Point(0, 1)); // bottom edge
brushes[8] = _getRadialBrush(R.BottomRight, new Point(0, 0)); // bottom-right corner
brushes.Apply(b => b.Freeze());
lock (_lock) {
_gradientBrushes[C, R] = brushes;
}
}
return _gradientBrushes[C, R];
}