KeyDown Message Capturing problem..

  • Thread starter Mohammad Omer Nasir
  • Start date
M

Mohammad Omer Nasir

Hi,

I am working on vs2k5 IDE for C# development. I made one Form which
has one button on it. I tried to override KeyDown message on From but
KeyDown message received. if Form does not containing any Item. When I
drop any thing on Form, it does not receive KeyDowm message. I want to
change button location according to Arrow keys. Please guide me what I
do it?

Regards,

-aims
 
M

Morten Wennevik [C# MVP]

Hi Mohammad,

Try overriding ProcessCmdKey on the Form

protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Left:
break;
case Keys.Right:
break;
case Keys.Up:
break;
case Keys.Down:
break;
}

return base.ProcessCmdKey(ref msg, keyData);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top