M
M
mihzas2015-08-26 12:09:43
C++ / C#
mihzas, 2015-08-26 12:09:43

How to override the behavior of the backspace key?

There is a form on Windows, in it richTextBox.
You need to make sure that the backspace key deletes a character in this control into a special buffer

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Fedoryan, 2015-08-26
@mihzas

private void richTextBox1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Back) {
                char s = richTextBox1.Text[richTextBox1.TextLength - 1];
                MessageBox.Show(s.ToString());
                // или копируем символ s в специальный буфер
            }
        }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question