Beispiel #1
0
        protected override bool ProcessDialogKey(Keys keyData)
        {
            if (SelectedGridItem != null &&
                ActiveControl != null &&
                ActiveControl.GetType().ToString() == "System.Windows.Forms.PropertyGridInternal.PropertyGridView" &&
                keyData == Keys.Delete)
            {
                PropertyAdapterBase adapter = this.SelectedObject as PropertyAdapterBase;

                if (adapter.WixFiles != null)
                {
                    adapter.WixFiles.UndoManager.BeginNewCommandRange();
                }

                CustomXmlPropertyDescriptorBase descriptor = this.SelectedGridItem.PropertyDescriptor as CustomXmlPropertyDescriptorBase;
                if (descriptor != null && descriptor.XmlElement != null)
                {
                    this.SelectedObject = null;
                    adapter.RemoveProperty(descriptor.XmlElement);
                    this.SelectedObject = adapter;

                    return(true);
                }
            }

            return(base.ProcessDialogKey(keyData));
        }
Beispiel #2
0
        // ESC TO CLOSE || KEYDOWN TO DOWNLIST || KEYUP TO UPLIST
        //------------------------------------------------------------------------------------------------------------
        private void frmUsuarioContaAcesso_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                e.Handled = true;
                btnClose_Click(sender, new EventArgs());
            }
            else if (e.KeyCode == Keys.Up && ActiveControl.GetType().BaseType.Name != "ComboBox")
            {
                e.Handled = true;

                if (lstItens.Items.Count > 0)
                {
                    if (lstItens.SelectedItems.Count > 0)
                    {
                        int i = lstItens.SelectedItems[0].Index;
                        lstItens.Items[i].Selected = false;

                        if (i == 0)
                        {
                            lstItens.Items[lstItens.Items.Count - 1].Selected = true;
                        }
                        else
                        {
                            lstItens.Items[i - 1].Selected = true;
                        }
                    }
                    else
                    {
                        lstItens.Items[0].Selected = true;
                    }

                    lstItens.EnsureVisible(lstItens.SelectedItems[0]);
                }
            }
            else if (e.KeyCode == Keys.Down && ActiveControl.GetType().BaseType.Name != "ComboBox")
            {
                e.Handled = true;

                if (lstItens.Items.Count > 0)
                {
                    if (lstItens.SelectedItems.Count > 0)
                    {
                        int i = lstItens.SelectedItems[0].Index;
                        lstItens.Items[i].Selected = false;
                        if (i == lstItens.Items.Count - 1)
                        {
                            i = -1;
                        }
                        lstItens.Items[i + 1].Selected = true;
                    }
                    else
                    {
                        lstItens.Items[0].Selected = true;
                    }

                    lstItens.EnsureVisible(lstItens.SelectedItems[0]);
                }
            }
        }
Beispiel #3
0
        private void btnMnuPaste_Click(object sender, EventArgs e)
        {
            if (ActiveControl.GetType() != typeof(TextBox))
            {
                return;
            }
            var thisControl = (TextBox)ActiveControl;

            // Paste the clipboard to the textbox
            // Determine if there is any text in the Clipboard to paste into the text box.
            var dataObject = Clipboard.GetDataObject();

            if (dataObject == null || dataObject.GetDataPresent(DataFormats.Text) != true)
            {
                return;
            }
            // Determine if any text is selected in the text box.
            if (thisControl.SelectionLength > 0)
            {
                // Ask user if they want to paste over currently selected text.
                if (
                    MessageBox.Show(@"Do you want to paste over current selection?", @"Cut Example",
                                    MessageBoxButtons.YesNo) == DialogResult.No)
                {
                    // Move selection to the point after the current selection and paste.
                    thisControl.SelectionStart = thisControl.SelectionStart + thisControl.SelectionLength;
                }
            }
            // Paste current text in Clipboard into text box.
            thisControl.Paste();
        }
        // ESC TO CLOSE || KEYDOWN TO DOWNLIST || KEYUP TO UPLIST
        //------------------------------------------------------------------------------------------------------------
        private void frmCongregacaoReuniaoListagem_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)
            {
                e.Handled = true;
                btnFechar_Click(sender, new EventArgs());
            }
            else if (e.KeyCode == Keys.Up && ActiveControl.GetType().BaseType.Name != "ComboBox")
            {
                e.Handled = true;

                if (dgvListagem.Rows.Count > 0)
                {
                    if (dgvListagem.SelectedRows.Count > 0)
                    {
                        int i = dgvListagem.SelectedRows[0].Index;
                        dgvListagem.Rows[i].Selected = false;
                        if (i == 0)
                        {
                            i = dgvListagem.Rows.Count;
                        }
                        dgvListagem.Rows[i - 1].Selected = true;
                    }
                    else
                    {
                        dgvListagem.Rows[0].Selected = true;
                    }

                    dgvListagem.FirstDisplayedScrollingRowIndex   = dgvListagem.SelectedRows[0].Index;
                    dgvListagem.SelectedRows[0].Cells[0].Selected = true;
                }
            }
            else if (e.KeyCode == Keys.Down && ActiveControl.GetType().BaseType.Name != "ComboBox")
            {
                e.Handled = true;

                if (dgvListagem.Rows.Count > 0)
                {
                    if (dgvListagem.SelectedRows.Count > 0)
                    {
                        int i = dgvListagem.SelectedRows[0].Index;
                        dgvListagem.Rows[i].Selected = false;
                        if (i == dgvListagem.Rows.Count - 1)
                        {
                            i = -1;
                        }
                        dgvListagem.Rows[i + 1].Selected = true;
                    }
                    else
                    {
                        dgvListagem.Rows[0].Selected = true;
                    }

                    dgvListagem.FirstDisplayedScrollingRowIndex   = dgvListagem.SelectedRows[0].Index;
                    dgvListagem.SelectedRows[0].Cells[0].Selected = true;
                }
            }
        }
Beispiel #5
0
 private bool IsRibbonGroupSelected()
 {
     if (ActiveControl.GetType() != typeof(RibbonGroup))
     {
         MessageBox.Show("Nessun gruppo selezionato...", "ATTENZIONE!!!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         return(false);
     }
     return(true);
 }
 void openContextMenu(object sender, EventArgs e)
 {
     // dirty Ctrl+C override avoidance (1/2)
     if (ActiveControl.GetType().Name == "TextBox")
     {
         TextBox t = (TextBox)ActiveControl;
         t.DeselectAll();
     }
 }
        private void pasteRuleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //If a textbox is focused let that handle ctrl-c and ctrl-v
            if (CtrlPressed && (ActiveControl != null) && (ActiveControl.GetType() == typeof(TextBox)))
            {
                ((TextBox)ActiveControl).Paste();
                return;
            }

            PasteRuleFromClipboard(true);
        }
        private void copyRuleToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //If a textbox is focused let that handle ctrl-c and ctrl-v
            if (CtrlPressed && (ActiveControl != null) && (ActiveControl.GetType() == typeof(TextBox)))
            {
                ((TextBox)ActiveControl).Copy();
                return;
            }

            CopyCurrentRuleToClipboard();
        }
Beispiel #9
0
        private void btnMnuCopy_Click(object sender, EventArgs e)
        {
            if (ActiveControl.GetType() != typeof(TextBox))
            {
                return;
            }
            var thisControl = (TextBox)ActiveControl;

            // Copy the textbox to the clipboard
            thisControl.Copy();
        }
Beispiel #10
0
        private void KeyPress_JF(object sender, KeyEventArgs e)
        {
            // Activar el KeyPreview = true en el formulario

            if ((ActiveControl.GetType().Name != "DataGridView") & (this.TSB_Salir.Enabled) & (e.KeyValue == 27 | e.KeyValue == 33 | e.KeyValue == 34 | e.KeyValue == 35 |
                                                                                               e.KeyValue == 36 | e.KeyValue == 36 | e.KeyValue == 46 | e.KeyValue == 116 | e.KeyValue == 117 | e.KeyValue == 118 | e.KeyValue == 119))
            {
                //MessageBox.Show(e.KeyCode + " | " + e.KeyData + " | " + e.KeyValue);
                //MessageBox.Show(sender.GetType().ToString());
                //MessageBox.Show(ActiveControl.GetType().Name);

                switch (e.KeyValue)
                {
                case 27:
                    this.TSB_Salir_Click(false, e);
                    break;

                case 33:
                    this.TSB_Anterior_Click(false, e);
                    break;

                case 34:
                    this.TSB_Siguiente_Click(false, e);
                    break;

                case 35:
                    this.TSB_Ultimo_Click(false, e);
                    break;

                case 36:
                    this.TSB_Primero_Click(false, e);
                    break;

                case 46:
                case 118:
                    this.TSB_Eliminar_Click(false, e);
                    break;

                case 116:
                    this.TSB_Agregar_Click(false, e);
                    break;

                case 117:
                    this.TSB_Modificar_Click(false, e);
                    break;

                case 119:
                    this.TSB_Imprimir_Click(false, e);
                    break;
                }
            }
        }
Beispiel #11
0
 private void BarcodeInputKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter && ActiveControl.GetType() == typeof(Bunifu.Framework.UI.BunifuMetroTextbox))
     {
         Bunifu.Framework.UI.BunifuMetroTextbox nextTextBox;
         if (TextBoxOrder.TryGetValue((Bunifu.Framework.UI.BunifuMetroTextbox)ActiveControl, out nextTextBox))
         {
             e.Handled          = true;
             e.SuppressKeyPress = true;
             nextTextBox.Focus();
         }
     }
 }
Beispiel #12
0
        private void btnMnuSelectAll_Click(object sender, EventArgs e)
        {
            if (ActiveControl.GetType() != typeof(TextBox))
            {
                return;
            }
            var thisControl = (TextBox)ActiveControl;

            // Copy the textbox to the clipboard
            thisControl.Focus();
            thisControl.SelectAll();
            thisControl.SelectionStart  = 0;
            thisControl.SelectionLength = thisControl.Text.Length;
        }
    void copyInstanceLinkClick(object sender, EventArgs e)
    {
        // dirty Ctrl+C override avoidance (2/2)
        if (ActiveControl.GetType().Name == "TextBox")
        {
            TextBox t = (TextBox)ActiveControl;

            if (t.SelectionLength != 0)
            {
                Clipboard.SetText(t.SelectedText);
                return;
            }
        }

        copyInstanceLinkToClipboard(instance);
    }
Beispiel #14
0
        private void undoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (ActiveControl.GetType() != typeof(TextBox))
            {
                return;
            }
            var thisControl = (TextBox)ActiveControl;

            // Determine if last operation can be undone in text box.
            if (thisControl.CanUndo != true)
            {
                return;
            }
            // Undo the last operation.
            thisControl.Undo();
            // Clear the undo buffer to prevent last action from being redone.
            thisControl.ClearUndo();
        }
 private void OnGMSDataEntryForm_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Return && e.Shift)
     {
         var ev = new EventArgs();
         OnButton_Click(buttonAdd, ev);
     }
     else if (e.KeyCode == Keys.Return)
     {
         if (ActiveControl.GetType().Name == "TextBox")
         {
             if (ActiveControl.Name == "textGonadWeight")
             {
                 buttonAdd.Focus();
             }
             else
             {
                 GetTextBox(fromTextBox: (TextBox)this.ActiveControl, getNext: true).Focus();
             }
         }
     }
 }
Beispiel #16
0
        // ESC TO CLOSE || KEYDOWN TO DOWNLIST || KEYUP TO UPLIST
        //------------------------------------------------------------------------------------------------------------
        private void form_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Escape)             // CLOSE FORM
            {
                e.Handled = true;
                btnFechar_Click(sender, new EventArgs());
            }
            // UP SELECTED ITEM IN LIST
            else if (e.KeyCode == Keys.Up && ActiveControl.GetType().BaseType.Name != "ComboBox")
            {
                e.Handled = true;

                if (lstItens.Items.Count > 0)
                {
                    if (lstItens.SelectedItems.Count > 0)
                    {
                        int i = lstItens.SelectedItems[0].Index;
                        lstItens.Items[i].Selected = false;

                        if (i == 0)
                        {
                            lstItens.Items[lstItens.Items.Count - 1].Selected = true;
                        }
                        else
                        {
                            lstItens.Items[i - 1].Selected = true;
                        }
                    }
                    else
                    {
                        lstItens.Items[0].Selected = true;
                    }

                    lstItens.EnsureVisible(lstItens.SelectedItems[0]);
                }
            }
            // DOWN SELECTED ITEM IN LIST
            else if (e.KeyCode == Keys.Down && ActiveControl.GetType().BaseType.Name != "ComboBox")
            {
                e.Handled = true;

                if (lstItens.Items.Count > 0)
                {
                    if (lstItens.SelectedItems.Count > 0)
                    {
                        int i = lstItens.SelectedItems[0].Index;
                        lstItens.Items[i].Selected = false;
                        if (i == lstItens.Items.Count - 1)
                        {
                            i = -1;
                        }
                        lstItens.Items[i + 1].Selected = true;
                    }
                    else
                    {
                        lstItens.Items[0].Selected = true;
                    }

                    lstItens.EnsureVisible(lstItens.SelectedItems[0]);
                }
            }
            else if (e.KeyCode == Keys.Delete)             // CLEAR PROCURA
            {
                txtProcura.Clear();
            }
            else if (e.KeyCode == Keys.Back)             // BACKSPACE LAST WORD IN PROCURA
            {
                int len = txtProcura.Text.Length;
                if (txtProcura.Text.Length > 0)
                {
                    txtProcura.Text = txtProcura.Text.Substring(0, len - 1);
                }
            }
        }
        /*------------------------------------------------------------------------------------------------
        *  TECLAS DE ATALHO:
        *
        *  --- ESC --> FECHA FORM
        *  --- ADD --> ADICIONAR REGISTRO
        *  --- SETA CIMA E BAIXO --> NAVEGA ENTRE OS ITENS DA LISTAGEM
        *  --- PGDOWN E PGUP --> ALTERA ATIVO
        *  ------------------------------------------------------------------------------------------------*/
        private void frmContribuinteListagem_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Escape:
                e.Handled = true;
                btnFechar_Click(sender, new EventArgs());
                break;

            case Keys.Add:
                e.Handled = true;
                btnAdicionar_Click(sender, new EventArgs());
                break;

            case Keys.Up:
                if (ActiveControl.GetType().BaseType.Name != "ComboBox")
                {
                    e.Handled = true;

                    if (dgvListagem.Rows.Count > 0)
                    {
                        if (dgvListagem.SelectedRows.Count > 0)
                        {
                            int i = dgvListagem.SelectedRows[0].Index;
                            dgvListagem.Rows[i].Selected = false;
                            if (i == 0)
                            {
                                i = dgvListagem.Rows.Count;
                            }
                            dgvListagem.Rows[i - 1].Selected = true;
                        }
                        else
                        {
                            dgvListagem.Rows[0].Selected = true;
                        }

                        dgvListagem.FirstDisplayedScrollingRowIndex   = dgvListagem.SelectedRows[0].Index;
                        dgvListagem.SelectedRows[0].Cells[0].Selected = true;
                    }
                }
                break;

            case Keys.Down:
                if (ActiveControl.GetType().BaseType.Name != "ComboBox")
                {
                    e.Handled = true;

                    if (dgvListagem.Rows.Count > 0)
                    {
                        if (dgvListagem.SelectedRows.Count > 0)
                        {
                            int i = dgvListagem.SelectedRows[0].Index;
                            dgvListagem.Rows[i].Selected = false;
                            if (i == dgvListagem.Rows.Count - 1)
                            {
                                i = -1;
                            }
                            dgvListagem.Rows[i + 1].Selected = true;
                        }
                        else
                        {
                            dgvListagem.Rows[0].Selected = true;
                        }

                        dgvListagem.FirstDisplayedScrollingRowIndex   = dgvListagem.SelectedRows[0].Index;
                        dgvListagem.SelectedRows[0].Cells[0].Selected = true;
                    }
                }
                break;

            case Keys.PageUp:
                e.Handled = true;

                if (cmbAtivo.SelectedIndex > 0)
                {
                    cmbAtivo.SelectedIndex -= 1;
                }
                else
                {
                    cmbAtivo.SelectedIndex = cmbAtivo.Items.Count - 1;
                }
                break;

            case Keys.PageDown:
                e.Handled = true;
                int maxIndex = cmbAtivo.Items.Count - 1;

                if (cmbAtivo.SelectedIndex < maxIndex)
                {
                    cmbAtivo.SelectedIndex += 1;
                }
                else
                {
                    cmbAtivo.SelectedIndex = 0;
                }
                break;

            default:
                e.Handled = false;
                break;
            }
        }
 private void onKeyDown(object sender, KeyEventArgs e)
 {
     Debug.WriteLine("key down {0}", ActiveControl.GetType().Name);
 }