本文整理匯總了C#中System.Windows.Media.BrushConverter.ConvertToString方法的典型用法代碼示例。如果您正苦於以下問題:C# BrushConverter.ConvertToString方法的具體用法?C# BrushConverter.ConvertToString怎麽用?C# BrushConverter.ConvertToString使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Media.BrushConverter
的用法示例。
在下文中一共展示了BrushConverter.ConvertToString方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: MainWindow
public MainWindow()
{
InitializeComponent();
vm = new GraphViewModel();
DataContext = vm;
//Set colors used by points
InputPointColoBrush = this.Resources["InputPointColorBrush"] as SolidColorBrush;
OutputPointColoBrush = this.Resources["OutputPointColoBrush"] as SolidColorBrush;
BrushConverter converter = new System.Windows.Media.BrushConverter();
string inputStrokeColor = converter.ConvertToString(InputPointColoBrush);
string outputStrokeColor = converter.ConvertToString(OutputPointColoBrush);
InputStroke = (Brush)converter.ConvertFromString(inputStrokeColor);
OutputStroke = (Brush)converter.ConvertFromString(outputStrokeColor);
}
示例2: TextFormat
public TextFormat(double size, FontType ft, FontStyle fs, FontWeight fw, SolidColorBrush brush, bool useUnderline)
{
this.FontSize = Math.Round(size, 1);
this.FontType = ft;
this.FontFamily = FontFactory.GetFontFamily(ft);
this.FontStyle = fs;
this.UseUnderline = useUnderline;
this.FontWeight = fw;
this.TextBrush = brush;
this.TypeFace = new Typeface(FontFamily, fs, fw, FontStretches.Normal, FontFactory.GetFontFamily(FontType.STIXGeneral));
BrushConverter bc = new BrushConverter();
TextBrushString = bc.ConvertToString(brush);
}