Last active
August 25, 2016 13:23
-
-
Save bjoerntx/8b4a6be38d06d0be1646de406bf690bf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void textControl1_KeyPress(object sender, KeyPressEventArgs e) | |
{ | |
switch (Convert.ToInt32(e.KeyChar)) | |
{ | |
// Enter key is pressed | |
case 13: | |
// get the currently active TextPart | |
IFormattedText textPart = | |
(IFormattedText)textControl1.TextParts.GetItem(); | |
// get the current line | |
TXTextControl.Line line = | |
textPart.Lines.GetItem(textPart.Selection.Start); | |
// remove the numbered list format type, if the line is empty | |
if (line.Text == "" || line.Text == "\r\n") | |
{ | |
if (textPart.Selection.ListFormat.Type != | |
TXTextControl.ListType.None) | |
{ | |
textPart.Selection.ListFormat.Type = | |
TXTextControl.ListType.None; | |
} | |
} | |
break; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment