Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button1_MouseDown(object sender, MouseEventArgs e)
- {
- foreach (Control t in this.Controls)
- {
- if (t is TextBox)
- {
- if (t.Focused)
- {
- MessageBox.Show(t.Name);
- }
- }
- }
- }
- private Control _focusedControl;
- private void TextBox_GotFocus(object sender, EventArgs e)
- {
- _focusedControl = (Control)sender;
- }
- private void button1_Click(object sender, EventArgs e)
- {
- if (_focusedControl != null)
- {
- //Change the color of the previously-focused textbox
- _focusedControl.BackColor = Color.Red;
- }
- }
- private void BtnKeyboard_Click(object sender, EventArgs e)
- {
- if (MasterKeyboard.Visible)
- {
- btnKeyboard.ButtonImage = Properties.Resources._001_22;
- MasterKeyboard.Visible = false;
- _lastFocusedControl.Focus();
- }
- else
- {
- btnKeyboard.ButtonImage = Properties.Resources._001_24;
- MasterKeyboard.Visible = true;
- MasterKeyboard.BringToFront();
- _lastFocusedControl.Focus();
- }
- }
- private Control _lastFocusedControl;
- private void BtnKeyboard_MouseHover(object sender, EventArgs e)
- {
- if (ActiveControl!=btnKeyboard)
- _lastFocusedControl = ActiveControl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement