1.RichTextBox 控件 - Windows Forms .NET Framework | Microsoft Learn
2.c# 代码编辑控件(代码着色控件) ICSharpCode.TextEditor 简单应用示例_风雪子郁的博客-CSDN博客
3.Fast Colored TextBox for Syntax Highlighting - CodeProject
展示效果
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>
1.nuget
2.设置:
标签:控件,高亮,Colored,Fast,TextEditor,文本框,ICSharpCode,Winform From: https://www.cnblogs.com/Zingu/p/17611280.html