本文整理汇总了C#中TextEditor.SetValue方法的典型用法代码示例。如果您正苦于以下问题:C# TextEditor.SetValue方法的具体用法?C# TextEditor.SetValue怎么用?C# TextEditor.SetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextEditor
的用法示例。
在下文中一共展示了TextEditor.SetValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ApplyToFolding
public static void ApplyToFolding(TextEditor editor, IEnumerable<CustomizedHighlightingColor> customisations)
{
bool assignedFoldingMarker = false, assignedSelectedFoldingControls = false, assignedFoldingTextMarkers = false;
editor.ClearValue(FoldingMargin.FoldingMarkerBrushProperty);
editor.ClearValue(FoldingMargin.FoldingMarkerBackgroundBrushProperty);
editor.ClearValue(FoldingMargin.SelectedFoldingMarkerBrushProperty);
editor.ClearValue(FoldingMargin.SelectedFoldingMarkerBackgroundBrushProperty);
FoldingElementGenerator.TextBrush = FoldingElementGenerator.DefaultTextBrush;
foreach (CustomizedHighlightingColor color in customisations) {
switch (color.Name) {
case FoldingControls:
if (assignedFoldingMarker)
continue;
assignedFoldingMarker = true;
if (color.Foreground != null)
editor.SetValue(FoldingMargin.FoldingMarkerBrushProperty, CreateFrozenBrush(color.Foreground.Value));
if (color.Background != null)
editor.SetValue(FoldingMargin.FoldingMarkerBackgroundBrushProperty, CreateFrozenBrush(color.Background.Value));
break;
case FoldingSelectedControls:
if (assignedSelectedFoldingControls)
continue;
assignedSelectedFoldingControls = true;
if (color.Foreground != null)
editor.SetValue(FoldingMargin.SelectedFoldingMarkerBrushProperty, CreateFrozenBrush(color.Foreground.Value));
if (color.Background != null)
editor.SetValue(FoldingMargin.SelectedFoldingMarkerBackgroundBrushProperty, CreateFrozenBrush(color.Background.Value));
break;
case FoldingTextMarkers:
if (assignedFoldingTextMarkers)
continue;
assignedFoldingTextMarkers = true;
if (color.Foreground != null)
FoldingElementGenerator.TextBrush = CreateFrozenBrush(color.Foreground.Value);
break;
}
}
}
示例2: ApplyToRendering
public static void ApplyToRendering(TextEditor editor, IEnumerable<CustomizedHighlightingColor> customisations)
{
bool assignedFoldingMarker = false, assignedSelectedFoldingControls = false, assignedFoldingTextMarkers = false;
editor.ClearValue(FoldingMargin.FoldingMarkerBrushProperty);
editor.ClearValue(FoldingMargin.FoldingMarkerBackgroundBrushProperty);
editor.ClearValue(FoldingMargin.SelectedFoldingMarkerBrushProperty);
editor.ClearValue(FoldingMargin.SelectedFoldingMarkerBackgroundBrushProperty);
FoldingElementGenerator.TextBrush = FoldingElementGenerator.DefaultTextBrush;
bool assignedErrorColor = false;
bool assignedWarningColor = false;
bool assignedMessageColor = false;
foreach (var instance in ErrorPainter.Instances) {
instance.ErrorColor = Colors.Red;
instance.WarningColor = Colors.Orange;
instance.MessageColor = Colors.Blue;
}
foreach (CustomizedHighlightingColor color in customisations) {
switch (color.Name) {
case FoldingControls:
if (assignedFoldingMarker)
continue;
assignedFoldingMarker = true;
if (color.Foreground != null)
editor.SetValue(FoldingMargin.FoldingMarkerBrushProperty,
CreateFrozenBrush(color.Foreground.Value));
if (color.Background != null)
editor.SetValue(FoldingMargin.FoldingMarkerBackgroundBrushProperty,
CreateFrozenBrush(color.Background.Value));
break;
case FoldingSelectedControls:
if (assignedSelectedFoldingControls)
continue;
assignedSelectedFoldingControls = true;
if (color.Foreground != null)
editor.SetValue(FoldingMargin.SelectedFoldingMarkerBrushProperty,
CreateFrozenBrush(color.Foreground.Value));
if (color.Background != null)
editor.SetValue(FoldingMargin.SelectedFoldingMarkerBackgroundBrushProperty,
CreateFrozenBrush(color.Background.Value));
break;
case FoldingTextMarkers:
if (assignedFoldingTextMarkers)
continue;
assignedFoldingTextMarkers = true;
if (color.Foreground != null)
FoldingElementGenerator.TextBrush = CreateFrozenBrush(color.Foreground.Value);
break;
case ErrorPainter.ErrorColorName:
if (assignedErrorColor)
continue;
assignedErrorColor = true;
if (color.Foreground != null) {
foreach (var instance in ErrorPainter.Instances) {
instance.ErrorColor = color.Foreground.Value;
}
}
break;
case ErrorPainter.WarningColorName:
if (assignedWarningColor)
continue;
assignedWarningColor = true;
if (color.Foreground != null) {
foreach (var instance in ErrorPainter.Instances) {
instance.WarningColor = color.Foreground.Value;
}
}
break;
case ErrorPainter.MessageColorName:
if (assignedMessageColor)
continue;
assignedMessageColor = true;
if (color.Foreground != null) {
foreach (var instance in ErrorPainter.Instances) {
instance.MessageColor = color.Foreground.Value;
}
}
break;
}
}
}