Yesterday, Avatar's avatar was displayed in the tool. After planning and adjusting the Avatar position, a world matrix was saved to the Avatar file. When avatar's avatar was displayed in the game, you only need to read the matrix of the world. Everything is ready. The experiment is successful. The message response originally in dialog is available. In order to improve the operation means, I decided to put the mouse event in cstatic to allow the planning to operate intuitively. Therefore, this requires two mouse events:
On_mousemove
On_mousewheel
When the left mouse button is pressed and the mouse is moved, the view is moved.
Right-click and move the mouse to rotate avatar.
However, there are still many problems.
Happy to write the processing.CodeAnd the results cannot be matched.
There was a very important reason. You need to set policy for cstatic. You can change it in the resource interface or in the creation function. In this way, you can support on_mousemove messages. However, on_mousewheel still cannot respond.
It turns out that cstatic is just like its name. It is a static control, and the static control cannot obtain the input focus by default. For example, editctrl, you can enter text at a point, but static controls are different. Therefore, to enable it to support mousewheel messages, you need to enable it to get focus.
Simply put, in the response to the on_lbuttondown and on_rbuttondown events in cstatic, You can manually set the focus.
A control without focus does not respond to onmousewheel, so you need to get the focus.
Void cstatictest: onlbuttondown (uint nflags, cpoint point)
{
// Todo: add your message handler code here and/or call default
Setfocus ();
Cstatic: onlbuttondown (nflags, point );
}
//
Void cstatictest: onrbuttondown (uint nflags, cpoint point)
{
// Todo: add your message handler code here and/or call default
Setfocus ();
Cstatic: onrbuttondown (nflags, point );
}
Now you can:
Bool cstatictest: onmousewheel (uint nflags, short zdelta, cpoint pt)
{
// Todo: add your message handler code here and/or call default
Afxmessagebox ("Haha ");//
Return cstatic: onmousewheel (nflags, zdelta, pt );
}
In general, the control does not respond to messages. There may be only two reasons. One is external reasons. The message of the control is filtered by the parent control, and the other is its own reason. This control, in itself, it only does not support certain types of messages, or does it need to enable a certain switch to support it? For example, if the cstatic notify switch is used, and you need to obtain the focus to respond to situations such as mousewheel.