[Solved] Transform text selected in a Textbox selected with a keyboard shortcut [closed]


You can use the TextBox.KeyUp event

private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
    if (e.Control && e.KeyValue == 49)
    {
        if (textBox1.SelectionLength > 0)
        {
            textBox1.SelectedText = String.Format("<h1>{0}</h1>", textBox1.SelectedText);
        }
    }
}

1

solved Transform text selected in a Textbox selected with a keyboard shortcut [closed]