本文整理匯總了C#中Windows.UI.Xaml.Media.Brush.ToString方法的典型用法代碼示例。如果您正苦於以下問題:C# Brush.ToString方法的具體用法?C# Brush.ToString怎麽用?C# Brush.ToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Windows.UI.Xaml.Media.Brush
的用法示例。
在下文中一共展示了Brush.ToString方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: BrushToString
/// <summary>
/// Brushes to string.
/// </summary>
/// <param name="brush">
/// The brush.
/// </param>
/// <returns>
/// brush type
/// </returns>
private static string BrushToString(Brush brush)
{
if (brush == null)
{
return "";
}
var solidColorBrush = brush as SolidColorBrush;
if (solidColorBrush != null)
{
return string.Format("SolidColorBrush: {0}", solidColorBrush.Color);
}
var imageBrush = brush as ImageBrush;
if (imageBrush != null)
{
var bi = imageBrush.ImageSource as BitmapImage;
if (bi != null)
{
return string.Format(
"ImageBrush: {0}, UriSource: {1}",
bi,
bi.UriSource);
}
return string.Format("ImageBrush: {0}", imageBrush.ImageSource);
}
return brush.ToString();
}