Example #1
0
 private void HandlePreviewKeyDown(PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter && _tbx_command.Text != string.Empty)
     {
         DebugManager.SendCommand(_tbx_command.Text);
         m_commands.Add(_tbx_command.Text);
         if (m_commands.Count > 50)
             m_commands.RemoveAt(0);
         m_pos = m_commands.Count - 1;
         _tbx_command.Text = string.Empty;
     }
     else if (e.KeyCode == Keys.Down)
     {
         if (m_commands.Count == 0)
             return;
         if (m_pos < 0)
             m_pos = m_commands.Count - 1;
         else if (m_pos >= m_commands.Count)
             m_pos = 0;
         _tbx_command.Text = m_commands[m_pos--];
     }
     else if (e.KeyCode == Keys.Up)
     {
         if (m_commands.Count == 0)
             return;
         if (m_pos < 0)
             m_pos = m_commands.Count - 1;
         else if (m_pos >= m_commands.Count)
             m_pos = 0;
         _tbx_command.Text = m_commands[m_pos++];
     }
 }
Example #2
0
 private void txtJudge_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtJudge.Text))
         {
             SetErrorStatus(true, "NG", "Judge không được để trống!");
             Ultils.EditTextErrorNoMessage(txtJudge);
         }
         else
         {
             if (txtJudge.Text.Trim() == "1" || txtJudge.Text.Trim() == "0")
             {
                 SetErrorStatus(false, null, null);
                 InsertLog(txtBoxID.Text);
             }
             else
             {
                 SetErrorStatus(true, "NG", "Judge Error!\nKhông đúng định dạng.\nVui lòng thử lại!\nChỉ chấp nhận giá trị: 1 hoặc 0 ");
                 txtJudge.SelectAll();
                 Ultils.EditTextErrorNoMessage(txtJudge);
             }
         }
     }
     if (e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtJudge.Text))
         {
             SetErrorStatus(true, "NG", "Judge không được để trống!");
             Ultils.EditTextErrorNoMessage(txtJudge);
         }
     }
 }
Example #3
0
 private void txtOperationID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtOperationID.Text))
         {
             Ultils.TextControlNotNull(txtOperationID, "Operation ID");
         }
         else
         {
             int op = int.Parse(txtOperationID.Text.Trim());
             if (op > 3)
             {
                 Ultils.EditTextErrorMessage(txtOperationID, "OperationID error!");
             }
             else
             {
                 if (string.IsNullOrEmpty(txtProcess.Text.Trim()))
                 {
                     txtProcess.Focus();
                 }
                 else
                 {
                     btnLogin.Focus();
                 }
             }
         }
     }
 }
Example #4
0
 private void MainForm_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode.Equals(Keys.Escape)) {
         this.Close();
         this.Dispose();
     }
 }
Example #5
0
 private void txtNroDocumento_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
 {
     if (e.KeyData == Keys.Tab)
     {
         e.IsInputKey = true;
     }
 }
Example #6
0
        private void maskedTextBoxNetworkIP_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            // MessageBox.Show("KeyDown");
            if (e.KeyCode == Keys.Tab)
            {
                int pos = maskedTextBoxNetworkIP.SelectionStart;
                int max = (maskedTextBoxNetworkIP.MaskedTextProvider.Length - maskedTextBoxNetworkIP.MaskedTextProvider.EditPositionCount);
                int nextField = 0;

                //MessageBox.Show(pos.ToString() + "" + max.ToString());

                for (int i = 0; i < maskedTextBoxNetworkIP.MaskedTextProvider.Length; i++)
                {
                    if (!maskedTextBoxNetworkIP.MaskedTextProvider.IsEditPosition(i) && (pos + max) >= i)
                        nextField = i;
                }
                nextField += 1;

                // We're done, enable the TabStop property again
                if (pos == nextField)
                    maskedTextBoxNetworkIP_Leave(this, e);

                maskedTextBoxNetworkIP.SelectionStart = nextField;
            }
        }
Example #7
0
 private void txtModelID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtModelID.Text))
         {
             Ultils.TextControlNotNull(txtModelID, "Model");
         }
         else
         {
             var model = _modelService.GetModelByName(txtModelID.Text, FujiXerox);
             if(model != null)
             {
                 Ultils.SetColorErrorTextControl(txtModelID, "Model này đã được tạo rồi. Vui lòng kiểm tra lại!");
                 
             }
             else
             {
                 txtQuantity.Focus();
             }
         }
     }
     if (e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtModelID.Text))
         {
             Ultils.TextControlNotNull(txtModelID, "Model");
         }
     }
 }
Example #8
0
 private void pictureBox2_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         profSelected = 0;
     }
 }
Example #9
0
 private static void SecondTypeControls(IPlayer player, PreviewKeyDownEventArgs e)
 {
     if (player == null)
     {
         return;
     }
     switch (e.KeyData)
     {
         case Keys.W:
             player.Car.MoveUp();
             break;
         case Keys.A:
             player.Car.MoveLeft();
             break;
         case Keys.D:
             player.Car.MoveRight();
             break;
         case Keys.S:
             player.Car.MoveDown();
             break;
         default:
             return;
     }
     Ui.Instance().RequireScreenUpdate();
 }
 private void webBrowser_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Back)
     {
         key = Keys.Back;
     }
 }
Example #11
0
 private void OnAddressEditPreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         OnGo(EventArgs.Empty);
     }
 }
Example #12
0
 private void webHelp_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Escape)
     {
         this.Close();
     }
 }
Example #13
0
 private async void textBoxICanTalk_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         await Send();
     }
 }
Example #14
0
        private void txtMacAddress_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (string.IsNullOrEmpty(txtMacAddress.Text))
                {
                    Ultils.TextControlNotNull(txtMacAddress, "Mac Address");
                }
                else
                {
                    if (txtMacAddress.Text.Length <= 2)
                    {
                        SetErrorStatus(true, "NG", "Mac Address Error!\nKhông đúng định dạng.\nVui lòng thử lại!");
                        txtMacAddress.SelectAll();
                        Ultils.EditTextErrorNoMessage(txtMacAddress);
                    }
                    else
                    {
                        txtJudge.Focus();
                        SetErrorStatus(false, "OK", null);
                    }

                }
            }
            if (e.KeyCode == Keys.Tab)
            {
                if (string.IsNullOrEmpty(txtMacAddress.Text))
                {
                    Ultils.TextControlNotNull(txtMacAddress, "Mac Address");
                }
            }
        }
Example #15
0
 private void txtBoxID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtBoxID.Text))
         {
             SetErrorStatus("NG", "Box ID không được để trống!");
             Ultils.EditTextErrorNoMessage(txtBoxID);
         }
         else
         {
             string strBoxId = txtBoxID.Text;
             if (strBoxId.Length >= 3)
             {
                 if (strBoxId.Substring(0, 3).ToUpper() != "F00")
                 {
                     SetErrorStatus("NG", "BOX ID phải bắt đầu bằng F00!");
                     Ultils.EditTextErrorNoMessage(txtBoxID);
                     txtBoxID.SelectAll();
                 }
                 else
                 {
                     txtProductID.Focus();
                 }
             }
             else
             {
                 SetErrorStatus("NG", "BOX ID không đúng định đạng!");
                 Ultils.EditTextErrorNoMessage(txtBoxID);
             }
         }
     }
 }
Example #16
0
 private void BUSCARALUMNO(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         MessageBox.Show("Buscando Coincidencia de Alumno....");
     }
 }
Example #17
0
        private void wbHelpDisplay_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
        {
            // TODO identify which keys should be allowed and which not

            switch (e.KeyCode)
            {
            case Keys.Right:
                if (e.Modifiers == Keys.Control)
                {
                    tsbNext_Click(sender, e);
                }
                return;

            case Keys.Left:
                if (e.Modifiers == Keys.Control)
                {
                    tsbPrev_Click(sender, e);
                }
                return;

            case Keys.Back:
                tsbPrev_Click(sender, e);
                return;

            case Keys.F1:
                return;
            }

            base.ProcessKeyDown(sender as Control, e.KeyCode, e.Modifiers);
        }
Example #18
0
 private void ClientSetup_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         this.Close();
     }
 }
Example #19
0
 /// <summary>
 /// Handles keys pressed while the browser has focus.
 /// </summary>
 private void KeyDownHandler(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         this.webBrowser.Focus();
     }
 }
 private void textBoxAutoComplete_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         hideAutoCompleteList();
     }
 }
Example #21
0
 private void ChromeBrowser_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
 {
     if (e.Modifiers == Keys.Control && e.KeyCode == Keys.F1)
     {
         BrowserKeyPressed?.Invoke(sender, e);
     }
 }
Example #22
0
 private void axShockwaveFlash1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.Control && e.KeyCode == Keys.V)
     {
         PlayNewChannel();
     }
 }
Example #23
0
 private void txtOperationID_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtOperationID.Text))
         {
             Ultils.TextControlNotNull(txtOperationID, "Operation ID");
         }
         else
         {
             btnLogin.Focus();
         }
     }
     if (e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtOperationID.Text))
         {
             Ultils.TextControlNotNull(txtOperationID, "Line");
         }
         else
         {
             btnLogin.Focus();
         }
     }
 }
Example #24
0
 private void listBoxProperties_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         Close();
     }
 }
Example #25
0
        private async void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyData == (Keys.Control | Keys.V))
            {
                var data = Clipboard.GetDataObject();
                if (data == null)
                    return;

                if (!data.GetDataPresent(typeof(string)))
                    return;

                var url = (string)data.GetData(typeof(string));

                try 
                {
                    new Uri(url);
                }
                catch
                {
                    return;
                }

                var eater = new Eater();
                if (eater.Prepare(url, DataFormats.Html))
                {
                    await eater.Eat(ConfigurationManager.AppSettings["path"]);
                    MessageBox.Show("Completed!");
                }

                //foreach (var format in data.GetFormats())
                //{
                //    var content = data.GetData(format);
                //}
            }
        }
Example #26
0
 private void keyDown(object sender, PreviewKeyDownEventArgs e)
 {
     switch (e.KeyCode)
     {
         case Keys.Up:
             ScrollTo(-2 * VerticalScroll.SmallChange - DisplayRectangle.Y);
             e.IsInputKey = false;
             break;
         case Keys.Down:
             ScrollTo(2 * VerticalScroll.SmallChange - DisplayRectangle.Y);
             e.IsInputKey = false;
             break;
         case Keys.PageUp:
             ScrollTo(-VerticalScroll.LargeChange - DisplayRectangle.Y);
             e.IsInputKey = false;
             break;
         case Keys.PageDown:
             ScrollTo(VerticalScroll.LargeChange - DisplayRectangle.Y);
             e.IsInputKey = false;
             break;
         case Keys.Home:
             ScrollTo(0);
             e.IsInputKey = false;
             break;
         case Keys.End:
             ScrollTo(Label.Height);
             e.IsInputKey = false;
             break;
     }
 }
 private void CurrentSelected_PreviewKeyDown(object TaggerObject, PreviewKeyDownEventArgs e) {
     e.IsInputKey = true;
     Tagger SelectedObject = (Tagger)TaggerObject, SwappingObject;
     int AlphaIndex, BetaIndex;
     if (e.KeyCode == Keys.Left) {
         AlphaIndex = StringCollection.Controls.GetChildIndex(CurrentSelected);
         BetaIndex = AlphaIndex - 1;
         if (AlphaIndex > 0) {
             SwappingObject = (Tagger)StringCollection.Controls[BetaIndex];
             StringCollection.Controls.SetChildIndex(SelectedObject, BetaIndex);
             StringCollection.Controls.SetChildIndex(SwappingObject, AlphaIndex);
             Tuple<int, string> TempTuple = TagGroupList[AlphaIndex];
             TagGroupList[AlphaIndex] = TagGroupList[BetaIndex];
             TagGroupList[BetaIndex] = TempTuple;
         }
     }
     if (e.KeyCode == Keys.Right) {
         AlphaIndex = StringCollection.Controls.GetChildIndex(CurrentSelected);
         BetaIndex = AlphaIndex + 1;
         if (AlphaIndex < count - 1) {
             SwappingObject = (Tagger)StringCollection.Controls[BetaIndex];
             StringCollection.Controls.SetChildIndex(SelectedObject, BetaIndex);
             StringCollection.Controls.SetChildIndex(SwappingObject, AlphaIndex);
             Tuple<int, string> TempTuple = TagGroupList[AlphaIndex];
             TagGroupList[AlphaIndex] = TagGroupList[BetaIndex];
             TagGroupList[BetaIndex] = TempTuple;
         }
     }
     CurrentSelected.Focus();
 }
Example #28
0
 private void Form1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
       {
     LoginProccess();
       }
 }
Example #29
0
        public void form1KeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            _mazePanel.move(e.KeyCode);

            if (_realMaze.currentBlock == _realMaze.exitBlock)
                _realMaze.solve();
        }
Example #30
0
        private void axWindowsMediaPlayer1_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.MediaNextTrack)
            {
                playnextSong(ind);

            }
            if (e.KeyCode == Keys.MediaPreviousTrack)
            {
                if (Shuffle == false)
                {
                    mediaplayer.Ctlcontrols.stop();

                    if (songListBox.SelectedIndex - 1 < 0)
                    {
                        songListBox.SelectedIndex = (int)songListBox.Items.Count - 1;
                        ind = (int)songListBox.SelectedValue;
                    }
                    else
                    {
                        songListBox.SelectedIndex = songListBox.SelectedIndex - 1;
                        ind = (int)songListBox.SelectedValue;
                    }

                    playSong(ind);
                }
            }
        }
Example #31
0
 private void txtOperatorCode_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtOperatorCode.Text))
         {
             Ultils.TextControlNotNull(txtOperatorCode, "Operator code");
         }
         else
         {
             gridLookUpEditModelID.Focus();
         }
     }
     if (e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtOperatorCode.Text))
         {
             Ultils.TextControlNotNull(txtOperatorCode, "Operator code");
         }
         else
         {
             gridLookUpEditModelID.Enabled = true;
         }
     }
 }
 void GraphicsDeviceControl_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right || e.KeyCode == Keys.Up || e.KeyCode == Keys.Down)
     {
         e.IsInputKey = true;
     }
 }
Example #33
0
 private void txtProductionId_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (string.IsNullOrEmpty(txtProductionId.Text))
         {
             Ultils.TextControlNotNull(txtProductionId, "The Production ID required.");
         }
         else
         {
             var production = _oqcService.GetLogByProductionId(txtProductionId.Text);
             if (production != null)
             {
                 txtBoxId.Focus();
             }
             else
             {
                 Ultils.EditTextErrorMessage(txtProductionId, "The Production ID not exits.");
             }
         }
     }
     if (e.KeyCode == Keys.Tab)
     {
         if (string.IsNullOrEmpty(txtProductionId.Text))
         {
             Ultils.TextControlNotNull(txtProductionId, "The Production ID required.");
         }
     }
 }
Example #34
0
 private void listBoxElements_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Escape)
     {
         DialogResult = DialogResult.Cancel;
         Close();
     }
 }
Example #35
0
        // </Snippet1>

        // <Snippet2>
        private void button1_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
        {
            // Check for the Control and Tab keys.
            if (e.KeyCode == Keys.Tab & e.Modifiers == Keys.Control)
            // Select the first shape.
            {
                rectangleShape1.Select();
            }
        }
Example #36
0
 protected override void OnPreviewKeyDown(System.Windows.Forms.PreviewKeyDownEventArgs e)
 {
     //按下回车键,指示不取消编辑
     if (e.KeyCode == System.Windows.Forms.Keys.Enter)
     {
         IsCancelEdit = false;
     }
     base.OnPreviewKeyDown(e);
 }
Example #37
0
        static void txtFile_PreviewKeyDown(object sender, Forms.PreviewKeyDownEventArgs e)
        {
            var txt = sender as Forms.TextBox;

            if (e.KeyCode == Forms.Keys.Enter && txt != null)
            {
                Tree.LoadTree(txt.Tag as FolderWindowGit, txt.Text);
            }
        }
Example #38
0
        // </Snippet20>

        // <Snippet21>
        private void ovalShape1_PreviewKeyDown(object sender,
                                               System.Windows.Forms.PreviewKeyDownEventArgs e)
        {
            if (e.KeyCode == Keys.F1)
            // Display a pop-up Help window to assist the user.
            {
                Help.ShowPopup(ovalShape1.Parent,
                               "This shape represents a network node.",
                               PointToScreen(new Point(ovalShape1.Width, ovalShape1.Height)));
            }
        }
Example #39
0
 private void image_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
 {
     switch (e.KeyData)
     {
     case Keys.Left:
     case Keys.Right:
     case Keys.Up:
     case Keys.Down:
         e.IsInputKey = true;     // make arrow keys show up in KeyDown event just like others...rather than to move controls
         break;
     }
 }
        void treeViewXmlDoc_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
        {
            System.Diagnostics.Trace.WriteLine(String.Format("PreviewKeyDown: sender: {3}, KeyValue: {0}, KeyCode: {1}, KeyData: {2}",
                                                             e.KeyValue, e.KeyCode, e.KeyData, sender.ToString()));

            int nIndex = dataGridViewConverterMapping.Rows.Count - 1;

            if ((e.KeyCode == Keys.Delete) && (nIndex > -1))
            {
                dataGridViewConverterMapping.Rows.RemoveAt(nIndex);
            }
        }
Example #41
0
 void webBrowser1_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
 {
     if (!this.IsOrderedList() && !this.IsUnorderedList())
     {
         if ((Keys)e.KeyData == Keys.Enter)
         {
             SendKeys.Send("{BS}");     //"{BS}" stands for the Backspace key
             SendKeys.Send("+{ENTER}"); // + -> Shift Key
             SendKeys.Send("{BREAK}");
         }
     }
 }
Example #42
0
        // <Snippet1>
        private void shapes_PreviewKeyDown(Shape sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
        {
            Shape sh;

            // Check for the Control and Tab keys.
            if (e.KeyCode == Keys.Tab && e.Modifiers == Keys.Control)
            // Find the next shape in the order.
            {
                sh = shapeContainer1.GetNextShape(sender, true);
                // Select the next shape.
                shapeContainer1.SelectNextShape(sender, false, true);
            }
        }
Example #43
0
        // <Snippet1>
        private void Shapes_PreviewKeyDown(object sender,
                                           System.Windows.Forms.PreviewKeyDownEventArgs e)
        {
            Shape sh;

            // Check for the TAB key.
            if (e.KeyCode == Keys.Tab)
            // Find the next shape in the order.
            {
                sh = shapeContainer1.GetNextShape((Shape)sender, true);
                // Select the next shape.
                shapeContainer1.SelectNextShape((Shape)sender, true, true);
            }
        }
Example #44
0
        private void unmountMenuItem_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Right:
                contextMenu.AutoClose = false;
                unmountMenuItem.DropDown.AutoClose = false;
                break;

            default:
                contextMenu.AutoClose = true;
                unmountMenuItem.DropDown.AutoClose = true;
                break;
            }
        }
Example #45
0
        /// <summary>
        /// Called when a key is down.
        /// </summary>
        private void OnCurrentControl_PreviewKeyDown(object?sender, WinForms.PreviewKeyDownEventArgs e)
        {
            if (_currentControl == null)
            {
                return;
            }

            // Notify event to keyboard state
            var actKeyCode = s_keyMappingDict[e.KeyCode];

            if (actKeyCode != WinVirtualKey.None)
            {
                _stateKeyboard.Internals.NotifyKeyDown(actKeyCode);
            }
        }
Example #46
0
 // <Snippet1>
 private void form1_PreviewKeyDown(object sender,
                                   System.Windows.Forms.PreviewKeyDownEventArgs e)
 {
     if (e.KeyCode == Keys.Space)
     {
         int    px;
         int    py;
         bool   hit;
         string result;
         px     = MousePosition.X;
         py     = MousePosition.Y;
         hit    = ovalShape1.HitTest(px, py);
         result = hit.ToString();
         MessageBox.Show(result);
     }
 }
Example #47
0
        protected override void OnPreviewKeyDown(System.Windows.Forms.PreviewKeyDownEventArgs e)
        {
            CustomPopupLookUpEditForm form = this.PopupForm as CustomPopupLookUpEditForm;

            base.OnPreviewKeyDown(e);
            if (char.IsLetterOrDigit((char)e.KeyCode))
            {
                lastChar = ((char)e.KeyCode).ToString();
            }
            else if (e.KeyData == Keys.Back)
            {
                lastChar = "backspace";
            }
            else
            {
                lastChar = "";
            }
        }
Example #48
0
        /// <summary>
        /// Add text Transformation for backspace/Delete
        /// Call from rtbtext.previewkeydown(which is important)
        /// </summary>
        /// <param name="key">The keypress event</param>
        /// <param name="SelectionIndex">The index of the cursor</param>
        public void KeyPressDelete(System.Windows.Forms.PreviewKeyDownEventArgs key, int SelectionIndex)
        {
            TextTransformActor req;

            if (key.KeyCode == Keys.Back)
            {//Backspace, delete the character before the cursor.
                req = new TextTransformActor(SelectionIndex - 1, 1);
                req.AlterForClient();
                queue.Add(req);
                thingy.Enqueue(req);
            }
            if (key.KeyCode == Keys.Delete)
            {//Delete key, deletes the character in front of the cursor
                req = new TextTransformActor(SelectionIndex, 1);
                req.AlterForClient();
                queue.Add(req);
                thingy.Enqueue(req);
            }
        }
Example #49
0
 private void contextMenu_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
 {
     if (mountMenuItem.Selected && (e.KeyCode == Keys.Right || e.KeyCode == Keys.Enter))
     {
         mountMenuItem.ShowDropDown();
     }
     else
     {
         mountMenuItem.HideDropDown();
     }
     if (unmountMenuItem.Selected && (e.KeyCode == Keys.Right || e.KeyCode == Keys.Enter))
     {
         unmountMenuItem.ShowDropDown();
     }
     else
     {
         unmountMenuItem.HideDropDown();
     }
 }
Example #50
0
 private void RichTextBox1_PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
 {
     throw new System.NotImplementedException();
 }
        protected override void OnPreviewKeyDown(System.Windows.Forms.PreviewKeyDownEventArgs e)
        {
            base.OnPreviewKeyDown(e);

            switch (e.KeyCode)
            {
            case System.Windows.Forms.Keys.Oemplus:
            case System.Windows.Forms.Keys.Add:
                --Zoom;
                break;

            case System.Windows.Forms.Keys.OemMinus:
            case System.Windows.Forms.Keys.Subtract:
                ++Zoom;
                break;

            default:
                if (_iConfiguration.ViewProjection != ViewProjection.ThreeDimensional)
                {
                    return;
                }
                break;
            }

            // These only apply for 3D

            switch (e.KeyCode)
            {
            case System.Windows.Forms.Keys.Up:
            case System.Windows.Forms.Keys.NumPad8:
                _xRotationInDegrees += RotationIncrementInDegrees;
                _xRotationInDegrees %= 360;
                break;

            case System.Windows.Forms.Keys.Down:
            case System.Windows.Forms.Keys.NumPad2:
                _xRotationInDegrees -= RotationIncrementInDegrees;
                _xRotationInDegrees %= 360;
                break;

            case System.Windows.Forms.Keys.Right:
            case System.Windows.Forms.Keys.NumPad6:
                _yRotationInDegrees += RotationIncrementInDegrees;
                _yRotationInDegrees %= 360;
                break;

            case System.Windows.Forms.Keys.Left:
            case System.Windows.Forms.Keys.NumPad4:
                _yRotationInDegrees -= RotationIncrementInDegrees;
                _yRotationInDegrees %= 360;
                break;

            case System.Windows.Forms.Keys.PageUp:
                _zRotationInDegrees += RotationIncrementInDegrees;
                _zRotationInDegrees %= 360;
                break;

            case System.Windows.Forms.Keys.PageDown:
                _zRotationInDegrees -= RotationIncrementInDegrees;
                _zRotationInDegrees %= 360;
                break;

            default:
                KeyPressHandled = false;
                return;
            }
            KeyPressHandled = true;
            Invalidate(ClientRectangle);
        }
Example #52
0
 public override void PreviewKeyDown(object sender, System.Windows.Forms.PreviewKeyDownEventArgs e)
 {
     base.PreviewKeyDown(sender, e);
 }