I am creating a Winforms application without开发者_开发百科 any Toolbars
. The main window has FormBorderStyle
set to Sizable
and ControlBox
is set to true
. Every time I hit Alt and then use Up or Down (not Alt+Up or Alt+Down) the control box shows up on the top left hand side of my application. This is annoying because there are shortcuts like Alt+R available in my grid, and if the user just presses and releases Alt and then Up to go to previous row the control box shows up.
How can I override this?
@Ken: I tried your code and focus was still going to ControlBox
for some reason.
Tweaked it a bit and it worked perfectly for my needs.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == (Keys.RButton | Keys.ShiftKey | Keys.Alt))
{ return true; }
return base.ProcessCmdKey(ref msg, keyData);
}
How about this:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
if (keyData == Keys.Alt)
{
keyData = Keys.None;
}
return base.ProcessCmdKey(ref msg, keyData);
}
Did you try setting ShowIcon
to false
?
精彩评论