本文整理匯總了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];
}