Home > Software engineering >  Excuse me, how to implement in the MFC right key levels to control the movement of the rectangle
Excuse me, how to implement in the MFC right key levels to control the movement of the rectangle

Time:10-15

Is to draw a rectangle then click mobile command can be used to implement the rectangular -> the up and down or so key move, but can also be other ways of implementation, and request a great god help!

CodePudding user response:


PreTranslateMessage event
If (pMsg - & gt; Message==WM_KEYDOWN) is a keyboard events

CodePudding user response:

 if (WM_KEYDOWN==pMsg - & gt; Message)//here to judge the type of message, is WM_KEYDOWN said keys news 
{
If ((VK_LEFT==pMsg - & gt; WParam))//judgment which buttons here
{
//here after the add button to do
}
}

CodePudding user response:

Also can give you the main form of directly adding WM_KEYDOWN message processing function, which is inside the message processing function directly determine the button is pressed

CodePudding user response:

Ok, I will, thank you!!!!!!
  • Related