예제 #1
0
 protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
 {
     if ((keyData & Keys.KeyCode) == Keys.B && ((keyData & Keys.Modifiers) & Keys.Control) == Keys.Control)
     {
         if (WindowState != FormWindowState.Minimized)
         {
             WindowState = FormWindowState.Minimized;
             return true;
         }
     }
     else if (((keyData & Keys.KeyCode) == Keys.C && ((keyData & Keys.Modifiers) & Keys.Control) == Keys.Control) || (keyData & Keys.KeyCode) == Keys.Insert && ((keyData & Keys.Modifiers) & Keys.Control) == Keys.Control)
     {
         if (this.richTextBox1.SelectedText == "")
         {
             ClipBoardDialog dialog = new ClipBoardDialog();
             dialog.StartPosition = FormStartPosition.CenterParent;
             dialog.Setup(this, console);
             dialog.ShowDialog();
             return true;
         }
     }
     else if (((keyData & Keys.KeyCode) == Keys.V && ((keyData & Keys.Modifiers) & Keys.Control) == Keys.Control) || (keyData & Keys.KeyCode) == Keys.Insert && ((keyData & Keys.Modifiers) & Keys.Shift) == Keys.Shift)
     {
         if (Clipboard.GetDataObject() == null || !Clipboard.ContainsText())
             return true;
         else
         {
             if (Clipboard.GetDataObject().GetDataPresent(DataFormats.Text) == true)
                 richTextBox1.Paste(DataFormats.GetFormat(DataFormats.UnicodeText));
             return true;
         }
     }
     //else if (((int)keyData == (int)Keys.Control + (int)Keys.D) && Program.DebugMode)
     //{
     //    console.OpenDebugDialog();
     //    return true;
     //}
     //else if (((int)keyData == (int)Keys.Control + (int)Keys.R) && Program.DebugMode)
     //{
     //    if ((console.DebugDialog != null) && (console.DebugDialog.Created))
     //        console.DebugDialog.UpdateData();
     //}
     else if (Config.UseKeyMacro)
     {
         if ((int)keyData == (int)Keys.F1 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F1, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F1)
         {
             this.richTextBox1.Text = KeyMacro.MacroF1;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
         else if ((int)keyData == (int)Keys.F2 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F2, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F2)
         {
             this.richTextBox1.Text = KeyMacro.MacroF2;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
         else if ((int)keyData == (int)Keys.F3 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F3, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F3)
         {
             this.richTextBox1.Text = KeyMacro.MacroF3;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
         else if ((int)keyData == (int)Keys.F4 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F4, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F4)
         {
             this.richTextBox1.Text = KeyMacro.MacroF4;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
         else if ((int)keyData == (int)Keys.F5 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F5, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F5)
         {
             this.richTextBox1.Text = KeyMacro.MacroF5;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
         else if ((int)keyData == (int)Keys.F6 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F6, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F6)
         {
             this.richTextBox1.Text = KeyMacro.MacroF6;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
         else if ((int)keyData == (int)Keys.F7 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F7, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F7)
         {
             this.richTextBox1.Text = KeyMacro.MacroF7;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
         else if ((int)keyData == (int)Keys.F8 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F8, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F8)
         {
             this.richTextBox1.Text = KeyMacro.MacroF8;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
         else if ((int)keyData == (int)Keys.F9 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F9, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F9)
         {
             this.richTextBox1.Text = KeyMacro.MacroF9;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
         else if ((int)keyData == (int)Keys.F10 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F10, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F10)
         {
             this.richTextBox1.Text = KeyMacro.MacroF10;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
         else if ((int)keyData == (int)Keys.F11 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F11, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F11)
         {
             this.richTextBox1.Text = KeyMacro.MacroF11;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
         else if ((int)keyData == (int)Keys.F12 + (int)Keys.Shift)
         {
             if (this.richTextBox1.Text != "")
                 KeyMacro.SetMacro(Keys.F12, this.richTextBox1.Text);
             return true;
         }
         else if ((int)keyData == (int)Keys.F12)
         {
             this.richTextBox1.Text = KeyMacro.MacroF12;
             this.richTextBox1.SelectionStart = this.richTextBox1.Text.Length;
             return true;
         }
     }
     return base.ProcessCmdKey(ref msg, keyData);
 }
예제 #2
0
 private void ログをクリップボードにコピーToolStripMenuItem_Click(object sender, EventArgs e)
 {
     try
     {
         ClipBoardDialog dialog = new ClipBoardDialog();
         dialog.Setup(this, console);
         dialog.ShowDialog();
     }
     catch (Exception)
     {
         MessageBox.Show("予期せぬエラーが発生したためクリップボードを開けません");
         return;
     }
 }