mydlg.cpp
来自「visual c++ 时尚编程百例 全部源代码」· C++ 代码 · 共 93 行
CPP
93 行
// MyDlg.cpp : implementation file
//
#include "stdafx.h"
#include "MousePoint.h"
#include "MyDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// MyDlg dialog
MyDlg::MyDlg(CWnd* pParent /*=NULL*/)
: CDialog(MyDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(MyDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void MyDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(MyDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(MyDlg, CDialog)
//{{AFX_MSG_MAP(MyDlg)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_WM_RBUTTONDOWN()
ON_WM_RBUTTONUP()
ON_WM_MOUSEMOVE()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// MyDlg message handlers
void MyDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
SetDlgItemText(IDC_L,"Down");
// TODO: Add your message handler code here and/or call default
CDialog::OnLButtonDown(nFlags, point);
}
void MyDlg::OnLButtonUp(UINT nFlags, CPoint point)
{
SetDlgItemText(IDC_L,"Up");
// TODO: Add your message handler code here and/or call default
CDialog::OnLButtonUp(nFlags, point);
}
void MyDlg::OnRButtonDown(UINT nFlags, CPoint point)
{
SetDlgItemText(IDC_R,"Down");
// TODO: Add your message handler code here and/or call default
CDialog::OnRButtonDown(nFlags, point);
}
void MyDlg::OnRButtonUp(UINT nFlags, CPoint point)
{
SetDlgItemText(IDC_R,"Up");
// TODO: Add your message handler code here and/or call default
CDialog::OnRButtonUp(nFlags, point);
}
void MyDlg::OnMouseMove(UINT nFlags, CPoint point)
{
CString str;
str.Format("%d",point.x);
SetDlgItemText(IDC_X,str);
str.Format("%d",point.y);
SetDlgItemText(IDC_Y,str);
// TODO: Add your message handler code here and/or call default
CDialog::OnMouseMove(nFlags, point);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?