📄 inputview.cpp
字号:
// InputView.cpp : implementation file
//
#include "stdafx.h"
#include "DVMSTest.h"
#include "InputView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CInputView
IMPLEMENT_DYNCREATE(CInputView, CFormView)
CInputView::CInputView()
: CFormView(CInputView::IDD)
{
//{{AFX_DATA_INIT(CInputView)
m_Green = 0;
m_Red = 0;
m_Blue = 0;
//}}AFX_DATA_INIT
}
CInputView::~CInputView()
{
}
void CInputView::DoDataExchange(CDataExchange* pDX)
{
CFormView::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CInputView)
DDX_Text(pDX, IDC_EDIT_G, m_Green);
DDV_MinMaxUInt(pDX, m_Green, 0, 255);
DDX_Text(pDX, IDC_EDIT_R, m_Red);
DDV_MinMaxUInt(pDX, m_Red, 0, 255);
DDX_Text(pDX, IDC_EDIT_B, m_Blue);
DDV_MinMaxUInt(pDX, m_Blue, 0, 255);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CInputView, CFormView)
//{{AFX_MSG_MAP(CInputView)
ON_BN_CLICKED(IDC_REFRESH, OnRefresh)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CInputView diagnostics
#ifdef _DEBUG
void CInputView::AssertValid() const
{
CFormView::AssertValid();
}
void CInputView::Dump(CDumpContext& dc) const
{
CFormView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CInputView message handlers
void CInputView::OnRefresh()
{
// TODO: Add your control notification handler code here
CDVMSTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
//更改文档中的颜色,然后重画:
UpdateData();
pDoc->m_clr=RGB(m_Red,m_Green,m_Blue);
pDoc->SetModifiedFlag();
pDoc->UpdateAllViews(this);
}
CDVMSTestDoc * CInputView::GetDocument()
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CDVMSTestDoc)));
return (CDVMSTestDoc*)m_pDocument;
}
void CInputView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// TODO: Add your specialized code here and/or call the base class
CDVMSTestDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
m_Red =GetRValue(pDoc->m_clr);
m_Green=GetGValue(pDoc->m_clr);
m_Blue =GetBValue(pDoc->m_clr);
UpdateData(FALSE);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -