Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Last active August 25, 2016 13:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/8b4a6be38d06d0be1646de406bf690bf to your computer and use it in GitHub Desktop.
Save bjoerntx/8b4a6be38d06d0be1646de406bf690bf to your computer and use it in GitHub Desktop.
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