Example #1
0
        /// <summary>
        /// Fires off the 'F2keypressed' event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void objEditingcontrol_KeyDown(object sender, KeyEventArgs e)
        {
            try
            {
                if (e.KeyCode == Keys.F2)
                {
                    if (!this.ReadOnly)
                    {
                        if (blEnableF2Event)
                        {
                            F2EventArgs ke = new F2EventArgs(this.CurrentCell.RowIndex, this.CurrentCell.ColumnIndex);
                            if (F2keypressed != null)
                            {
                                F2keypressed(this, ke);
                            }
                            else
                            {
                                return;
                            }
                        }
                    }
                }

            }
            catch (Exception ex)
            {
            }
        }
        public override bool PreProcessMessage(ref Message msg)
        {
            Keys keyCode = (Keys)(int)msg.WParam & Keys.KeyCode;

                if (keyCode == Keys.F2)
                {
                    if (!this.ReadOnly)
                    {
                        // KeyEventArgs ke = new KeyEventArgs(Keys.F2);
                        if (this.CurrentCell != null)
                        {
                            F2EventArgs ke = new F2EventArgs(this.CurrentCell.RowIndex, this.CurrentCell.ColumnIndex);
                            if (F2keypressed != null)
                            {
                                F2keypressed(this, ke);
                            }
                            else
                            {
                                //return false;
                            }
                        }
                    }
                }

            return base.PreProcessMessage(ref msg);
        }