【VC开源代码栏目提醒】:网学会员,鉴于大家对VC开源代码十分关注,论文会员在此为大家搜集整理了“CommonView.cpp”一文,供大家参考学习!
// CommonView.cpp : implementation file
//
#include "stdafx.h"
#include "SDISplitter.h"
#include "CommonView.h"
#include "SDISplitterDoc.h"
// CColorView
IMPLEMENT_DYNCREATE(CColorView, CView)
CColorView::CColorView()
{
}
CColorView::~CColorView()
{
}
BEGIN_MESSAGE_MAP(CColorView, CView)
ON_WM_MOUSEACTIVATE()
END_MESSAGE_MAP()
// CColorView drawing
void CColorView::OnDraw(CDC* pDC)
{
CSDISplitterDoc* pDoc = GetDocument();
// TODO: add draw code here
CRect rect;
GetClientRect(rect);
// fill the view with the specified color
CBrush br(pDoc->m_colorData);
pDC->FillRect(rect, &br);
}
// CColorView diagnostics
#ifdef _DEBUG
void CColorView::AssertValid() const
{
CView::AssertValid();
}
void CColorView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
// CColorView message handlers
// CommonView.cpp : implementation file
//
int CColorView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
return CView::OnMouseActivate(pDesktopWnd, nHitTest, message);
}
void CColorView::OnActivateView(BOOL, CView*, CView*)
{
ASSERT(FALSE); // output only view - should never be active
}
// CommonView.cpp : implementation file
//
// CTextView
IMPLEMENT_DYNCREATE(CTextView, CView)
CTextView::CTextView()
{
}
CTextView::~CTextView()
{
}
BEGIN_MESSAGE_MAP(CTextView, CView)
ON_WM_MOUSEACTIVATE()
END_MESSAGE_MAP()
// CTextView drawing
void CTextView::OnDraw(CDC* pDC)
{
CSDISplitterDoc* pDoc = GetDocument();
// TODO: add draw code here
CRect rect;
GetClientRect(rect);
pDC->SetTextAlign(TA_BASELINE | TA_CENTER);
pDC->SetTextColor(pDoc->m_colorData);
pDC->SetBkMode(TRANSPARENT);
// center in the window
pDC->TextOut(rect.Width() / 2, rect.Height() / 2,
pDoc->m_strData, pDoc->m_strData.GetLength());
}
// CTextView diagnostics
#ifdef _DEBUG
void CTextView::AssertValid() const
{
CView::AssertValid();
}
void CTextView::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
#endif //_DEBUG
// CTextView message handlers
int CTextView::OnMouseActivate(CWnd* pDesktopWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
return CView::OnMouseActivate(pDesktopWnd, nHitTest, message);
}
上一篇:
CommonRepairForm.cpp
下一篇:
西班牙语童话:El Alimento de Dios