【VC开源代码栏目提醒】:文章导读:在新的一年中,各位网友都进入紧张的学习或是工作阶段。网学会员整理了VC开源代码-AutoServerView.cpp的相关内容供大家参考,祝大家在新的一年里工作和学习顺利!
// AutoServerView.cpp : implementation of the CAutoServerView class
//
#include "stdafx.h"
#include "AutoServer.h"
#include "AutoServerDoc.h"
#include "AutoServerView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CAutoServerView
IMPLEMENT_DYNCREATE(CAutoServerView, CView)
BEGIN_MESSAGE_MAP(CAutoServerView, CView)
//{{AFX_MSG_MAP(CAutoServerView)
ON_COMMAND(ID_FILL_BLUE, OnFillBlue)
ON_COMMAND(ID_FILL_GREEN, OnFillGreen)
ON_COMMAND(ID_FILL_RED, OnFillRed)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CAutoServerView construction/destruction
CAutoServerView::CAutoServerView()
{
// TODO: add construction code here
}
CAutoServerView::~CAutoServerView()
{
}
BOOL CAutoServerView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CAutoServerView drawing
void CAutoServerView::OnDraw(CDC* pDC)
{
CAutoServerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
CRect rect(100,100,250,200);
CBrush* pBrush=new CBrush;
pBrush->CreateSolidBrush(pDoc->m_nFillColor);
pDC->FillRect(rect,pBrush);
}
/////////////////////////////////////////////////////////////////////////////
// CAutoServerView diagnostics
#ifdef _DEBUG
void CAutoServerView::AssertValid() const
{
CView::AssertValid();
}
void CAutoServerView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CAutoServerDoc* CAutoServerView::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CAutoServerDoc)));
return (CAutoServerDoc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CAutoServerView message handlers
void CAutoServerView::OnFillBlue()
{
// TODO: Add your command handler code here
CAutoServerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->m_nFillColor=RGB(0,0,255);
CDC* pDC=GetDC();
OnDraw(pDC);
}
void CAutoServerView::OnFillGreen()
{
// TODO: Add your command handler code here
CAutoServerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->m_nFillColor=RGB(0,255,0);
CDC* pDC=GetDC();
OnDraw(pDC);
}
void CAutoServerView::OnFillRed()
{
// TODO: Add your command handler code here
CAutoServerDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
pDoc->m_nFillColor=RGB(255,0,0);
CDC* pDC=GetDC();
OnDraw(pDC);
}
上一篇:
AutoServerDoc.cpp
下一篇:
行走梵净山之(三)一世一遇,即是懂得