当前位置: 首页>>代码示例>>C#>>正文


C# TextEditor.SetValue方法代码示例

本文整理汇总了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;
				}
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:41,代码来源:HighlightingOptions.xaml.cs

示例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;
				}
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:85,代码来源:HighlightingOptions.xaml.cs


注:本文中的TextEditor.SetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。