protected bool CanProcessMnemonic()
{
Control c = this;
// Test each control in parent chain
while (c != null)
{
// Control must be visible and enabled
if (!c.Visible || !c.Enabled)
return false;
// Move up one level
c = c.Parent;
}
// Every control in chain is visible and enabled, so allow mnemonics
return true;
}