# Koala.Pro.CodeGenerator **Repository Path**: youhui_xm/koala.pro.codegenerator ## Basic Information - **Project Name**: Koala.Pro.CodeGenerator - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 4 - **Forks**: 4 - **Created**: 2024-08-27 - **Last Updated**: 2025-12-25 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ICSharpCode.TextEditorEx is an extension project based on ICSharpCode.TextEditor, providing enhanced text editing features for WinForms applications on the .NET platform. The project primarily includes a text editor control (TextEditorControlEx) that supports syntax highlighting, code folding, bookmarks, find and replace, and can be integrated into various development environments. ## Project Features - **Syntax Highlighting**: Supports syntax highlighting for multiple programming languages, including C#, VB.NET, Java, HTML, XML, SQL, and more. - **Code Folding**: Supports collapsing and expanding code blocks to improve code readability. - **Bookmarks**: Allows users to add, navigate, and manage bookmarks within code. - **Find and Replace**: Provides powerful find and replace functionality with support for regular expressions and highlighting of matched items. - **Context Menu Support**: Customizable context menus with support for icons and keyboard shortcuts. - **Clipboard Operations**: Supports standard editing operations such as cut, copy, paste, and delete. - **Code Formatting**: Supports code transformation operations, such as case conversion and space/tab conversion. - **Undo/Redo**: Offers a comprehensive undo and redo mechanism. ## Usage Example Here is a simple usage example demonstrating how to use `TextEditorControlEx` in a WinForms application: ```csharp using System; using System.Windows.Forms; using ICSharpCode.TextEditor; namespace WinFormTestXmlEditor { public partial class MainForm : Form { public MainForm() { InitializeComponent(); // Initialize the text editor textEditorControl1.Document.HighlightingStrategy = HighlightingManager.Manager.FindHighlighter("XML"); textEditorControl1.Text = "value"; } private void textEditorControl1_TextChanged(object sender, EventArgs e) { // Update folding information when text changes UpdateAndCheckFoldings(); } private void UpdateAndCheckFoldings() { // Update code folding information textEditorControl1.Document.FoldingManager.UpdateFoldings("XML", null); } private void cmbHighlight_SelectedIndexChanged(object sender, EventArgs e) { // Switch syntax highlighting based on selected language string selectedItem = cmbHighlight.SelectedItem as string; if (selectedItem != null) { textEditorControl1.SetHighlighting(selectedItem); } } private void UpdateText(string selectedItem) { // Update text content based on selected example switch (selectedItem) { case "XML": textEditorControl1.Text = Resources.ExampleXML; break; case "C#": textEditorControl1.Text = Resources.ExampleCSharp; break; case "F#": textEditorControl1.Text = Resources.ExampleFSharp; break; } } } } ``` ## Installation and Usage 1. **Get the Source Code**: Clone the project source code from the Gitee repository: ```bash git clone https://gitee.com/youhui_xm/koala.pro.codegenerator.git ``` 2. **Build the Project**: Open the solution file `ICSharpCode.TextEditorEx.Solution.sln` using Visual Studio or another .NET-compatible IDE, and build the project. 3. **Integrate into Your Application**: Reference `ICSharpCode.TextEditorEx.dll` in your WinForms project and add the `TextEditorControlEx` control to your form. 4. **Configure Syntax Highlighting**: Set the syntax highlighting language using the `SetHighlighting` method, for example: ```csharp textEditorControlEx1.SetHighlighting("XML"); ``` 5. **Set Code Folding Strategy**: Configure the code folding strategy using the `FoldingStrategy` property, for example: ```csharp textEditorControlEx1.FoldingStrategy = "XML"; ``` ## Project Structure - `ICSharpCode.TextEditorEx/ICSharpCode.TextEditor/`: Core text editor components. - `ICSharpCode.TextEditorEx/ICSharpCode.TextEditorEx/`: Implementation of extended features, including syntax highlighting and code folding. - `ICSharpCode.TextEditorEx/WinFormTestXmlEditor/`: Example project demonstrating how to use `TextEditorControlEx` to implement an XML editor. ## License This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. ## Contributors Contributions to code and documentation are welcome. Please refer to [CONTRIBUTING.md](CONTRIBUTING.md) for contribution guidelines. ## Contact For questions or suggestions, please open an issue in the Gitee repository or contact the project maintainers.