For some reason I want the Form.show (modeless) instead of showdialog(modal), combined with the keydown override, I want when pressing ctrl + A all the datagrid rows will be selected, however in some cases (because the form shows modeless so the command is executed on the main form), what should I do to make the command always execute if the form is showing?
Here is the code I am using:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (SFForm.Visible == true)
SFForm.Activate(); //Focus SFForm
if ((keyData.HasFlag(Keys.A) && keyData.HasFlag(Keys.Control)))
{
this.f_DataGrid1.SelectionMode = GridSelectionMode.Extended;
f_DataGrid1.SelectAll();
return true;
}
else if ()
{
}
return base.ProcessCmdKey(msg, keyData);
}