KeyEvent
How do I use Key Event
Below are practical examples compiled from projects for learning and reference purposes
Featured Snippets
Line | Code | Ex.. |
---|---|---|
129 | private void InputTxt_KeyDown(object sender, KeyEventArgs e) | 1 |
630 | private void mainrichTextBox_KeyDown(object sender, KeyEventArgs e) | 2 |
File name: ChatBot.cs
Copy
129 private void InputTxt_KeyDown(object sender, KeyEventArgs e)
130 {
131 if (e.KeyCode == Keys.Enter)
132 {
133 showOutput();
134 e.SuppressKeyPress = true; // Disable windows error sound
135 }
136 }
File name: notepad1.cs
Copy
630 private void mainrichTextBox_KeyDown(object sender, KeyEventArgs e)
631 {
632 if (Control.IsKeyLocked(Keys.CapsLock))
633 {
634 capstoolStripStatusLabel.Text = " Caps ON";
635 }
636 else
637 {
638 capstoolStripStatusLabel.Text = " Caps OFF";
639 }
640
641 }
KeyEvent 126 lượt xem
Gõ tìm kiếm nhanh...