📄 rctview.cpp
字号:
// RCTView.cpp : implementation file
//
#include "stdafx.h"
#include "MDTTest.h"
#include "RCTView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRCTView
IMPLEMENT_DYNCREATE(CRCTView, CView)
CRCTView::CRCTView()
{
}
CRCTView::~CRCTView()
{
}
BEGIN_MESSAGE_MAP(CRCTView, CView)
//{{AFX_MSG_MAP(CRCTView)
ON_COMMAND(ID_RCT_COLOR, OnRctColor)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRCTView drawing
void CRCTView::OnDraw(CDC* pDC)
{
CRCTDoc * pDoc = GetDocument();
// TODO: add draw code here
CRect rc;
GetClientRect(&rc);
CRect rcdraw(rc.left +rc.Width ()/4,
rc.top +rc.Height()/4,
rc.right -rc.Width ()/4,
rc.bottom-rc.Height()/4
);
CBrush br(pDoc->m_clr),*ob;
ob=pDC->SelectObject(&br);
pDC->Rectangle(&rcdraw);
pDC->SelectObject(&ob);
br.DeleteObject();
}
/////////////////////////////////////////////////////////////////////////////
// CRCTView diagnostics
#ifdef _DEBUG
void CRCTView::AssertValid() const
{
CView::AssertValid();
}
void CRCTView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CRCTView message handlers
void CRCTView::OnRctColor()
{
// TODO: Add your command handler code here
CRCTDoc * pDoc = GetDocument();
if(m_ClrDlg.DoModal()==IDOK)
{
pDoc->m_clr=RGB(
m_ClrDlg.m_Red,
m_ClrDlg.m_Green,
m_ClrDlg.m_Blue
);
pDoc->SetModifiedFlag();
}
Invalidate();
UpdateWindow();
}
CRCTDoc * CRCTView::GetDocument()
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CRCTDoc)));
return (CRCTDoc*)m_pDocument;
}
void CRCTView::OnInitialUpdate()
{
CView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
CRCTDoc * pDoc = GetDocument();
m_ClrDlg.m_Red =GetRValue(pDoc->m_clr);
m_ClrDlg.m_Green=GetGValue(pDoc->m_clr);
m_ClrDlg.m_Blue =GetBValue(pDoc->m_clr);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -