📄 exampcomctlview.cpp
字号:
// ExampComctlView.cpp : implementation of the CExampComctlView class
//
#include "stdafx.h"
#include "ExampComctl.h"
#include "ExampComctlDoc.h"
#include "ExampComctlView.h"
#include "ComctDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExampComctlView
IMPLEMENT_DYNCREATE(CExampComctlView, CView)
BEGIN_MESSAGE_MAP(CExampComctlView, CView)
//{{AFX_MSG_MAP(CExampComctlView)
ON_COMMAND(ID_TEST_COMCTL, OnTestComctl)
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExampComctlView construction/destruction
CExampComctlView::CExampComctlView()
{
// TODO: add construction code here
}
CExampComctlView::~CExampComctlView()
{
}
BOOL CExampComctlView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CExampComctlView drawing
void CExampComctlView::OnDraw(CDC* pDC)
{
CExampComctlDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CExampComctlView printing
BOOL CExampComctlView::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CExampComctlView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CExampComctlView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CExampComctlView diagnostics
#ifdef _DEBUG
void CExampComctlView::AssertValid() const
{
CView::AssertValid();
}
void CExampComctlView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CExampComctlDoc* CExampComctlView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CExampComctlDoc)));
return (CExampComctlDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CExampComctlView message handlers
void CExampComctlView::OnTestComctl()
{
// TODO: Add your command handler code here
CComctDlg dlg;
if(dlg.DoModal()!=IDOK)
return ;
Invalidate();
UpdateWindow();
CClientDC dc(this);
CPen penNew, *ppenOld;
penNew.CreatePen(PS_SOLID, dlg.m_nLineWt, RGB(0,0,0));
ppenOld=dc.SelectObject(&penNew);
dc.Ellipse(0,0,2*dlg.m_nRadius,2*dlg.m_nRadius);
dc.SelectObject(ppenOld);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -