📄 drawingbox.cpp
字号:
// DrawingBox.cpp : implementation file
//
#include "stdafx.h"
#include "SoccerDoctor.h"
#include "DrawingBox.h"
#include "Displayer.h"
// CDrawingBox dialog
IMPLEMENT_DYNAMIC(CDrawingBox, CDialog)
CDrawingBox::CDrawingBox(CWnd* pParent,CDisplayer* pDisplayer)
: CDialog(CDrawingBox::IDD, pParent),_pDisplayer(pDisplayer),_DrawType(DRAWNONE)
{
}
CDrawingBox::~CDrawingBox()
{
}
void CDrawingBox::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_CIRCLE, _CircleButton);
DDX_Control(pDX, IDC_POINT, _PointButton);
DDX_Control(pDX, IDC_LINE, _LineButton);
DDX_Control(pDX, IDC_RECTANGLE, _RectangleButton);
DDX_Control(pDX, IDC_ARROWHAND, _ArrowHandButton);
DDX_Control(pDX, IDC_SELECT, _SelectButton);
}
BEGIN_MESSAGE_MAP(CDrawingBox, CDialog)
ON_BN_CLICKED(IDC_ARROWHAND, OnBnClickedArrowhand)
ON_BN_CLICKED(IDC_CIRCLE, OnBnClickedCircle)
ON_BN_CLICKED(IDC_LINE, OnBnClickedLine)
ON_BN_CLICKED(IDC_POINT, OnBnClickedPoint)
ON_BN_CLICKED(IDC_RECTANGLE, OnBnClickedRectangle)
ON_BN_CLICKED(IDC_SELECT, OnBnClickedSelect)
END_MESSAGE_MAP()
// CDrawingBox message handlers
BOOL CDrawingBox::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
_LineBitmap.LoadBitmap(IDB_LINE);
_LineButton.SetBitmap(_LineBitmap);
_PointBitmap.LoadBitmap(IDB_POINT);
_PointButton.SetBitmap(_PointBitmap);
_RectangleBitmap.LoadBitmap(IDB_RECTANGLE);
_RectangleButton.SetBitmap(_RectangleBitmap);
_CircleBitmap.LoadBitmap(IDB_CIRCLE);
_CircleButton.SetBitmap(_CircleBitmap);
_ArrowHandBitmap.LoadBitmap(IDB_ARROWHAND);
_ArrowHandButton.SetBitmap(_ArrowHandBitmap);
_SelectBitmap.LoadBitmap(IDB_SELECT);
_SelectButton.SetBitmap(_SelectBitmap);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
BOOL CDrawingBox::PreTranslateMessage(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
if( _pDisplayer->DeliverMessage(pMsg) )
return TRUE;
return CDialog::PreTranslateMessage(pMsg);
}
void CDrawingBox::OnBnClickedArrowhand()
{
_DrawType = DRAWNONE;
}
void CDrawingBox::OnBnClickedCircle()
{
_DrawType = DRAWCIRCLE;
}
void CDrawingBox::OnBnClickedLine()
{
_DrawType = DRAWLINE;
}
void CDrawingBox::OnBnClickedPoint()
{
_DrawType = DRAWPOINT;
}
void CDrawingBox::OnBnClickedRectangle()
{
_DrawType = DRAWRECTANGLE;
}
void CDrawingBox::OnBnClickedSelect()
{
_DrawType = DRAWSELECT;
}
void CDrawingBox::OnCancel()
{
_DrawType = DRAWNONE;
ShowWindow(SW_HIDE);
// CDialog::OnCancel();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -