|
1 | | -# How to customize the end of line style in Winforms EditControl? |
| 1 | +# How to Customize the End-of-Line Style in WinForms EditControl |
| 2 | +This repository demonstrates how to customize the **end-of-line style** in the Syncfusion WinForms **EditControl**. The EditControl is a powerful text editor component that supports syntax highlighting, code editing, and advanced customization options. By default, the control displays a standard end-of-line marker, but developers may want to modify its appearance to match application themes or improve readability. |
2 | 3 |
|
3 | | -This sample illustrates how to customize the end of line style in Winforms EditControl. |
| 4 | +## Why Customize End-of-Line Style? |
| 5 | +Customizing the end-of-line style can help developers: |
| 6 | +- Provide visual cues for line endings in code editors. |
| 7 | +- Improve clarity when working with files that contain mixed line endings. |
| 8 | +- Enhance the overall user experience by aligning with custom themes. |
4 | 9 |
|
| 10 | +## Key Features Demonstrated in This Sample |
| 11 | +- Change the end-of-line marker style programmatically. |
| 12 | +- Apply custom colors and shapes to the marker. |
| 13 | +- Update styles dynamically based on user preferences or application themes. |
| 14 | + |
| 15 | +## Code Example |
| 16 | +```C# |
| 17 | +public partial class Form1 : Form |
| 18 | +{ |
| 19 | + private Syncfusion.Windows.Forms.Edit.EditControl editControl1; |
| 20 | + private Syncfusion.Windows.Forms.Tools.ComboBoxAdv comboboxAdv1; |
| 21 | + |
| 22 | + public Form1() |
| 23 | + { |
| 24 | + InitializeComponent(); |
| 25 | + |
| 26 | + // Initialize EditControl |
| 27 | + editControl1 = new Syncfusion.Windows.Forms.Edit.EditControl |
| 28 | + { |
| 29 | + Location = new Point(20, 100), |
| 30 | + Size = new Size(600, 400), |
| 31 | + BackColor = Color.White, |
| 32 | + ShowEndOfLine = true, |
| 33 | + BorderStyle = BorderStyle.FixedSingle, |
| 34 | + Dock = DockStyle.Fill, |
| 35 | + ShowVerticalSplitters = false, |
| 36 | + ShowHorizontalSplitters = false, |
| 37 | + DefaultNewLineStyle = Syncfusion.IO.NewLineStyle.Windows |
| 38 | + }; |
| 39 | + |
| 40 | + editControl1.LoadFile(); |
| 41 | + this.panel2.Controls.Add(editControl1); |
| 42 | + |
| 43 | + // Initialize ComboBoxAdv for selecting newline style |
| 44 | + comboboxAdv1 = new Syncfusion.Windows.Forms.Tools.ComboBoxAdv |
| 45 | + { |
| 46 | + Location = new Point(this.checkBox1.Location.X, this.checkBox1.Location.Y + 50), |
| 47 | + Size = new Size(120, 80) |
| 48 | + }; |
| 49 | + |
| 50 | + comboboxAdv1.Items.AddRange(new string[] { "Windows", "Mac", "Unix", "Control" }); |
| 51 | + comboboxAdv1.SelectedIndex = 0; |
| 52 | + comboboxAdv1.SelectedIndexChanged += ComboboxAdv1_SelectedIndexChanged; |
| 53 | + this.panel1.Controls.Add(comboboxAdv1); |
| 54 | + } |
| 55 | + |
| 56 | + private void ComboboxAdv1_SelectedIndexChanged(object sender, EventArgs e) |
| 57 | + { |
| 58 | + switch ((sender as ComboBoxAdv).SelectedIndex) |
| 59 | + { |
| 60 | + case 0: |
| 61 | + editControl1.SetNewLineStyle(Syncfusion.IO.NewLineStyle.Windows); |
| 62 | + break; |
| 63 | + case 1: |
| 64 | + editControl1.SetNewLineStyle(Syncfusion.IO.NewLineStyle.Mac); |
| 65 | + break; |
| 66 | + case 2: |
| 67 | + editControl1.SetNewLineStyle(Syncfusion.IO.NewLineStyle.Unix); |
| 68 | + break; |
| 69 | + case 3: |
| 70 | + editControl1.SetNewLineStyle(Syncfusion.IO.NewLineStyle.Control); |
| 71 | + break; |
| 72 | + } |
| 73 | + } |
| 74 | + |
| 75 | + private void checkBox1_CheckedChanged(object sender, EventArgs e) |
| 76 | + { |
| 77 | + editControl1.ShowEndOfLine = checkBox1.Checked; |
| 78 | + } |
| 79 | +} |
| 80 | +``` |
| 81 | + |
| 82 | +## Output |
5 | 83 |  |
0 commit comments