IC_HAPPY1 2008-4-22 16:44
请问MFC下如何实现按钮的拖动!!!!
我在界面建立了一个Button控件,向实现一下拖动Button到界面的任意位置!
我的思想是
void CMy1Dlg::OnLButtonDown(UINT nFlags, CPoint point)
{
这里我觉得应该填写半段是不是点击的Button?但是代吗总是写错!!
CDialog::OnLButtonDown(nFlags, point);
}
void CMy1Dlg::OnMouseMove(UINT nFlags, CPoint point)
{
这里不断的跟着鼠标刷新位置!!!
CDialog::OnMouseMove(nFlags, point);
}
void CMy1Dlg::OnLButtonUp(UINT nFlags, CPoint point)
{
这里要实现返回Button的位置!!!
CDialog::OnLButtonUp(nFlags, point);
}
请教各位代码如何编写啊 ????拜谢!!!!!!
Nothing 2008-4-22 17:23
::OnMouseMove(UINT nFlags, CPoint point)
nFlags里有按键的信息,看MSDN中关于nFlags的说明
nFlags
Indicates whether various virtual keys are down. This parameter can be any combination of the following values:
MK_CONTROL Set if the CTRL key is down.
MK_LBUTTON Set if the left mouse button is down.
MK_MBUTTON Set if the middle mouse button is down.
MK_RBUTTON Set if the right mouse button is down.
MK_SHIFT Set if the SHIFT key is down.