📄 exmptabctlview.cpp
字号:
// ExmpTabCtlView.cpp : implementation of the CExmpTabCtlView class
//
#include "stdafx.h"
#include "ExmpTabCtl.h"
#include "ExmpTabCtlDoc.h"
#include "ExmpTabCtlView.h"
#include "TabDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExmpTabCtlView
IMPLEMENT_DYNCREATE(CExmpTabCtlView, CView)
BEGIN_MESSAGE_MAP(CExmpTabCtlView, CView)
//{{AFX_MSG_MAP(CExmpTabCtlView)
ON_COMMAND(ID_TEST_TAB, OnTestTab)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExmpTabCtlView construction/destruction
CExmpTabCtlView::CExmpTabCtlView()
{
// TODO: add construction code here
}
CExmpTabCtlView::~CExmpTabCtlView()
{
}
BOOL CExmpTabCtlView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CExmpTabCtlView drawing
void CExmpTabCtlView::OnDraw(CDC* pDC)
{
CExmpTabCtlDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CExmpTabCtlView diagnostics
#ifdef _DEBUG
void CExmpTabCtlView::AssertValid() const
{
CView::AssertValid();
}
void CExmpTabCtlView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CExmpTabCtlDoc* CExmpTabCtlView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CExmpTabCtlDoc)));
return (CExmpTabCtlDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CExmpTabCtlView message handlers
void CExmpTabCtlView::OnTestTab()
{
// TODO: Add your command handler code here
CTabDlg dlg;
if (dlg.DoModal()!=IDOK)
return;
Invalidate(); // 使用户视图区域无效,以清除上一次画的圆
UpdateWindow(); // 刷新用户视图区域
CClientDC dc(this);
CPen penNew, *ppenOld;
penNew.CreatePen(PS_SOLID, dlg.m_ComctlDlg.m_nLineWt, RGB(0,0,0)); // 创建指定宽度的画笔
ppenOld=dc.SelectObject(&penNew); // 选择创建的画笔
dc.Ellipse(0, 0, 2*dlg.m_ComctlDlg.m_nRadius, 2*dlg.m_ComctlDlg.m_nRadius); // 根据设置的线宽和半径绘圆
dc.SelectObject(ppenOld); // 恢复原来的画笔
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -