?? moveablebutton.cpp
字號:
// MoveableButton.cpp : implementation file
//
#include "stdafx.h"
#include "MoveableButton.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMoveableButton
CMoveableButton::CMoveableButton()
{
m_bStartMove = FALSE;
}
CMoveableButton::~CMoveableButton()
{
}
BEGIN_MESSAGE_MAP(CMoveableButton, CButton)
//{{AFX_MSG_MAP(CMoveableButton)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMoveableButton message handlers
void CMoveableButton::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_bStartMove = TRUE;
CButton::OnLButtonDown(nFlags, point);
}
void CMoveableButton::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
m_bStartMove = FALSE;
CButton::OnLButtonUp(nFlags, point);
}
void CMoveableButton::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
if (m_bStartMove)
{
CRect rect;
ClientToScreen(&point);
this->GetParent()->ScreenToClient(&point);
GetClientRect(&rect);
point.Offset(-rect.Width()/2, -rect.Height()/2);
SetWindowPos(NULL, point.x , point.y , 0, 0, SWP_NOZORDER|SWP_NOSIZE);
// afxDump<<point.x<<","<<point.y<<"\n";
Invalidate();
}
CButton::OnMouseMove(nFlags, point);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -