当左键按下按钮不松开鼠标时,消息如何响应?
当左键松开时,消息又如何响应?
谢谢啦
当左键松开时,消息又如何响应?
谢谢啦
解决方案 »
- 如何在cdhtmldialog中限制HTML显示范围
- Microsoft Visual C++ 2008 Express Edition有播放电视的控件吗
- DLL注入记事本进程后为什么创建的窗口消失,用OllyDBG.EXE的loaddll.exe却可以显示
- 对话框里怎么动态添加组建
- 大家来讨论一下怎么设计一个动画效果
- 多少人在写商业程序时使用Release进行编写?DEBUG呢??两者好处?
- 一个简单函数的功能?
- 请问要做一个类似课件制作的软件,其中的图形绘制是用GDI还是别的什么东西
- FAR修饰符
- 急救:关于打印!
- 请教大家两个小问题...
- 请问鼠标移到联系人上面会出现联系人的一个信息框,这个信息框怎么实现?
有buttondown消息,但无buttonup消息 也可视作常按
当左键松开时,消息又如何响应?
===================================================
这里有几个消息都会产生,按下时产生:WM_LBUTTONDOWN,不松开时有WM_MOUSEMOVE消息,松开时会产生:WM_LBUTTONUP消息。
{
//
// Record the anchor point and set the tracking flag.
//
m_ptFrom = point;
m_ptTo = point;
m_bTracking = TRUE; //
// If capture is enabled, capture the mouse.
//
if (m_bCaptureEnabled)
SetCapture ();
}void CMainWindow::OnMouseMove (UINT nFlags, CPoint point)
{
//
// If the mouse is moved while we're "tracking" (that is, while a
// line is being rubber-banded), erase the old rubber-band line and
// draw a new one.
//
if (m_bTracking) {
CClientDC dc (this);
InvertLine (&dc, m_ptFrom, m_ptTo);
InvertLine (&dc, m_ptFrom, point);
m_ptTo = point;
}
}void CMainWindow::OnLButtonUp (UINT nFlags, CPoint point)
{
//
// If the left mouse button is released while we're tracking, release
// the mouse if it's currently captured, erase the last rubber-band
// line, and draw a thick red line in its place.
//
if (m_bTracking) {
m_bTracking = FALSE;
if (GetCapture () == this)
::ReleaseCapture (); CClientDC dc (this);
InvertLine (&dc, m_ptFrom, m_ptTo); CPen pen (PS_SOLID, 16, RGB (255, 0, 0));
dc.SelectObject (&pen); dc.MoveTo (m_ptFrom);
dc.LineTo (point);
}
}void CMainWindow::OnNcLButtonDown (UINT nHitTest, CPoint point)
{
//
// When the window's title bar is clicked with the left mouse button,
// toggle the capture flag on or off and update the window title.
//
if (nHitTest == HTCAPTION) {
m_bCaptureEnabled = m_bCaptureEnabled ? FALSE : TRUE;
SetWindowText (m_bCaptureEnabled ?
_T ("Mouse Capture Demo (Capture Enabled)") :
_T ("Mouse Capture Demo (Capture Disabled)"));
}
CFrameWnd::OnNcLButtonDown (nHitTest, point);
}