⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 colortoolview.cpp

📁 本压缩软件为《Visual C++6.0基础教程》(黑魔方系列)一书的源代码
💻 CPP
字号:
// colortoolView.cpp : implementation of the CColortoolView class
//

#include "stdafx.h"
#include "colortool.h"

#include "colortoolDoc.h"
#include "colortoolView.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif


/////////////////////////////////////////////////////////////////////////////
// CColortoolView

IMPLEMENT_DYNCREATE(CColortoolView, CView)

BEGIN_MESSAGE_MAP(CColortoolView, CView)
	//{{AFX_MSG_MAP(CColortoolView)
	ON_COMMAND(IDC_BLU, OnBlu)
	ON_COMMAND(IDC_GRE, OnGre)
	ON_COMMAND(IDC_PIN, OnPin)
	ON_COMMAND(IDC_YEL, OnYel)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CColortoolView construction/destruction

CColortoolView::CColortoolView()
{
	// TODO: add construction code here
}

CColortoolView::~CColortoolView()
{
}

BOOL CColortoolView::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CColortoolView drawing

void CColortoolView::OnDraw(CDC* pDC)
{
	CColortoolDoc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
    pDC->TextOut(0,0,"选择工具条按钮,改变窗口颜色!");
	// TODO: add draw code for native data here
}
/////////////////////////////////////////////////////////////////////////////
// CColortoolView diagnostics

#ifdef _DEBUG
void CColortoolView::AssertValid() const
{
	CView::AssertValid();
}

void CColortoolView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CColortoolDoc* CColortoolView::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CColortoolDoc)));
	return (CColortoolDoc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CColortoolView message handlers

void CColortoolView::OnBlu() 
{
	// TODO: Add your command handler code here
	GetClientRect(&rect);   //取得操作窗口大小
	CBrush brush(RGB(0,0,255));
	CClientDC dc(this);
	dc.FillRect(&rect,&brush);
}
void CColortoolView::OnGre() 
{
	// TODO: Add your command handler code here
	GetClientRect(&rect);   //取得操作窗口大小
	CBrush brush(RGB(0,255,0));
	CClientDC dc(this);
	dc.FillRect(&rect,&brush);	
}
void CColortoolView::OnPin() 
{
	// TODO: Add your command handler code here
	GetClientRect(&rect);   //取得操作窗口大小
	CBrush brush(RGB(255,0,255));
	CClientDC dc(this);
	dc.FillRect(&rect,&brush);	
}

void CColortoolView::OnYel() 
{
	// TODO: Add your command handler code here
	GetClientRect(&rect);   //取得操作窗口大小
	CBrush brush(RGB(255,255,0));
	CClientDC dc(this);
	dc.FillRect(&rect,&brush);	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -