首页 > 其他分享 >Winform 富文本框字体高亮

Winform 富文本框字体高亮

时间:2023-08-07 14:13:19浏览次数:43  
标签:控件 高亮 Colored Fast TextEditor 文本框 ICSharpCode Winform

1.RichTextBox 控件 - Windows Forms .NET Framework | Microsoft Learn

2.c# 代码编辑控件(代码着色控件) ICSharpCode.TextEditor 简单应用示例_风雪子郁的博客-CSDN博客

3.Fast Colored TextBox for Syntax Highlighting - CodeProject

 

展示效果

 

 二:ICSharpCode.TextEditor 

1.Nuget

 2.配置文件.xshd

<SyntaxDefinition name = "JackC#" extensions = ".cs">

	<Environment>
		<Custom name="TypeReference" bold="false" italic="false" color="#04ABAB" />
		<Custom name="UnknownEntity" bold="false" italic="false" color="#AB0404" />
	</Environment>

	<Properties>
		<Property name="LineComment" value="//"/>
	</Properties>

	<Digits name = "Digits" bold = "false" italic = "false" color = "DarkBlue"/>

	<RuleSets>
		<RuleSet ignorecase="false">
			<Delimiters>&<>~!%^*()-+=|\#/{}[]:;"' ,	.?</Delimiters>


			<MarkPrevious bold = "true" italic = "false" color = "MidnightBlue">(</MarkPrevious>

			<KeyWords name = "Punctuation" bold = "false" italic = "false" color = "Blue">
				<Key word = "base" />
				<Key word = "public" />
				<Key word = "class" />
				<Key word = "string" />
				<Key word = "Ceiling" />
				<Key word = "Cos" />
				<Key word = "Exp" />
				<Key word = "Floor" />
				<Key word = "IEEERemainder" />
				<Key word = "Log" />
				<Key word = "Log10" />
				<Key word = "Max" />
				<Key word = "Min" />
				<Key word = "Pow" />
				<Key word = "*" />
				<Key word = "Round" />
				<Key word = "Sign" />
				<Key word = "Sin" />
				<Key word = "Sqrt" />
				<Key word = "Tan" />
				<Key word = "Truncate" />
			</KeyWords>


			<KeyWords name = "Punctuation" bold = "false" italic = "false" color = "Red">
				<Key word = "?" />
				<Key word = "," />
				<Key word = "." />
				<Key word = ";" />
				<Key word = "(" />
				<Key word = ")" />
				<!--<Key word = "[" />
        <Key word = "]" />-->
				<Key word = "{" />
				<Key word = "}" />
				<Key word = "+" />
				<Key word = "-" />
				<Key word = "/" />
				<Key word = "%" />
				<Key word = "*" />
				<Key word = "not" />
				<Key word = "and" />
				<Key word = "or" />
				<Key word = "<" />
				<Key word = ">" />
				<Key word = "^" />
				<Key word = "or" />
				<Key word = "=" />
				<Key word = "~" />
				<Key word = "!" />
				<Key word = "|" />
				<Key word = "&" />
			</KeyWords>



			<!--获取类函数-->
			<KeyWords name = "Punctuation" bold = "false" italic = "false" color = "#3E6776">
				<Key word = "CalcArea" />
				<Key word = "CalcRel" />
				<Key word = "GetEleValue" />
				<Key word = "GetSenValue" />
				<Key word = "GetTID" />
				<Key word = "GetCID" />
				<Key word = "GetAPID" />
				<Key word = "GetRCID" />
			</KeyWords>


			<!--类型转换-->
			<KeyWords name = "Punctuation" bold = "false" italic = "false" color = "#246AF2">
				<Key word = "ToDecimal" />
				<Key word = "ToDouble" />
				<Key word = "ToFloat" />
				<Key word = "ToInt16" />
				<Key word = "ToInt32" />
				<Key word = "ToInt64" />
				<Key word = "ToDateTime" />
				<Key word = "ToBoolean" />
				<Key word = "ToChar" />
				<Key word = "ToString" />
			</KeyWords>


			<!--专用函数-->
			<KeyWords name = "Punctuation" bold = "false" italic = "false" color = "#4297E2">
				<Key word = "Q_TriaWeir" />
				<Key word = "Q_TrapWeir" />
				<Key word = "Q_RectWeir" />
				<Key word = "Q_VAM" />
				<Key word = "VWP_P" />
				<Key word = "VWP_HW" />
				<Key word = "VWP_HA" />
				<Key word = "IsNULL" />
			</KeyWords>


			<!--测值-->
			<KeyWords name = "Punctuation" bold = "false" italic = "false" color = "#67B23B">
				<Key word = "[]" />
			</KeyWords>
		</RuleSet>
	</RuleSets>
</SyntaxDefinition>

  

三: Fast Colored TextBox 

1.nuget

 2.设置:

 

标签:控件,高亮,Colored,Fast,TextEditor,文本框,ICSharpCode,Winform
From: https://www.cnblogs.com/Zingu/p/17611280.html

相关文章

  • c#串口通信讲解(一)(winform、wpf)
    转载:https://blog.csdn.net/weixin_30466421/article/details/99278174串口操作需要注意的几点如下:1、如果是USB转串口;则需要安装USB转串口驱动,附件有此驱动。2、串口打开状态最好不要直接插拔串口,可能会导致中控板或者串口线烧坏。3、使用串口调试工具CEIWEI,下一章节会贴上......
  • 盘点下4个Winform UI开源控件库
    今天一起来盘点下4个WinformUI开源控件库,有.NetFramework,也有.NetCore。 1、支持.Net7的开源UI组件框架项目简介这是一个基于.NetFramework、.Net6+开发的,WinForm开源UI框架,框架包含常用的控件库、工具类库、扩展类库、单窗口库、多窗口库。默认风格是模仿Element的主......
  • ppt怎么添加文本框
    1、点击插入打开打开PPT后点击上方工具栏插入打开。2、点击文本框在插入工具栏下点击文本框打开。3、插入文本框在幻灯片上拖动鼠标即可添加文本框。......
  • el-table表头高亮动画效果
    el-table表头高亮动画效果<divclass="front-table"><el-table:data="tableData"height="100%"stripe:header-cell-style="{backgroundC......
  • Winform两个项目间的调用
    Winform1:staticclassProgram   {       ///<summary>       ///应用程序的主入口点。       ///</summary>       [STAThread]       staticvoidMain(string[]args)       {           Application.Ena......
  • c# WinForm 引用 Chrome 模拟操作
    Nuget CefSharp.WinForms publicForm1(){InitializeComponent();chromiumWebBrowser1.LoadingStateChanged+=ChromiumWebBrowser1_LoadingStateChanged;}privatevoidbutton1_Click(objectsender,EventArgs......
  • WinForm RichTextBox 加载大量文本卡死和UTF-8乱码问题
    在RichTextBox控件的使用中我们会遇到加载TXT文件的问题,通常我们会有两种处理方式。一、加载TXT字符串,设置到RichTextBox//打开并且读取文件数据FileStreamfs=newFileStream(txtPath,FileMode.Open,FileAccess.Read);StreamReadersr=newStreamReader(fs,Encoding.U......
  • Apipost变量高亮展示,变量操作更流畅
    之前Apipost配置的各种环境变量只能在右上角环境管理中查看,很多小伙伴希望能有一种更好的解决方案用以快速复制变量值,快速查看变量的当前值和初始值,于是在Apipost7.1.7中我们推出环境变量高亮展示功能来满足用户的使用需求。功能描述:当用户在请求地址、以及参数值设置中引用到变量......
  • Apipost变量高亮展示,变量操作更流畅
    之前Apipost配置的各种环境变量只能在右上角环境管理中查看,很多小伙伴希望能有一种更好的解决方案用以快速复制变量值,快速查看变量的当前值和初始值,于是在Apipost7.1.7中我们推出环境变量高亮展示功能来满足用户的使用需求。功能描述:当用户在请求地址、以及参数值设置中引用到......
  • 左侧导航右侧内容对应位置高亮
      <divclass="mc_aside_navboxmc_aside_navbox1show">    <ulclass="mc_aside_nav">      <liclass="mc_aside_li on">        111      </li>      <liclass="m......