private void FilterTextBox_KeyPress(object sender, KeyPressEventArgs e) { TweenMain main = (TweenMain)this.Owner; TextBox tbox = (TextBox)sender; if (e.KeyChar == '@') { //if (!SettingDialog.UseAtIdSupplement) return; //@マーク main.ShowSuplDialog(tbox, main.AtIdSupl); e.Handled = true; } else if (e.KeyChar == '#') { //if (!SettingDialog.UseHashSupplement) return; main.ShowSuplDialog(tbox, main.HashSupl); e.Handled = true; } }
private void FilterTextBox_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Space && e.Modifiers == (Keys.Shift | Keys.Control)) { TweenMain main = (TweenMain)this.Owner; TextBox tbox = (TextBox)sender; if (tbox.SelectionStart > 0) { int endidx = tbox.SelectionStart - 1; string startstr = ""; for (int i = tbox.SelectionStart - 1; i >= 0; i--) { char c = tbox.Text[i]; if (Char.IsLetterOrDigit(c) || c == '_') { continue; } if (c == '@') { startstr = tbox.Text.Substring(i + 1, endidx - i); main.ShowSuplDialog(tbox, main.AtIdSupl, startstr.Length + 1, startstr); } else if (c == '#') { startstr = tbox.Text.Substring(i + 1, endidx - i); main.ShowSuplDialog(tbox, main.HashSupl, startstr.Length + 1, startstr); } else { break; } } e.Handled = true; } } }