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

📄 stringview.cpp

📁 《面向对象程序设计实用教程》一书的源码
💻 CPP
字号:
// StringView.cpp : implementation file
//

#include "stdafx.h"
#include "cge.h"
#include "StringView.h"

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


/////////////////////////////////////////////////////////////////////////////
// CStringView

IMPLEMENT_DYNCREATE(CStringView, CView)

CStringView::CStringView()
{
	Fontl.CreatePointFont(80,"Arial");
}

CStringView::~CStringView()
{
  
}


BEGIN_MESSAGE_MAP(CStringView, CView)
	//{{AFX_MSG_MAP(CStringView)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStringView drawing

void CStringView::OnDraw(CDC* pDC)
{
	CWgl_32Doc* pDoc = GetDocument();
	if(pDoc->bReadError) return;
	int y;
	CString strTemp;
	pDC->SetBkMode(TRANSPARENT);
	CFont *OldFont=(CFont *)pDC->SelectObject(CFont::FromHandle(Fontl));
	COLORREF GOldRGB = pDC->SetTextColor(RGB(128,255,255));
	y = 0;
	strTemp = _T("故障绝对时刻:");
	pDC->TextOut(1,y,strTemp);
	y += 9;
	pDC->TextOut(18,y,pDoc->DateTime1);
	y += 9;
	strTemp = _T("录波触发时刻:");
	pDC->TextOut(1,y,strTemp);
	y += 9;
	pDC->TextOut(18,y,pDoc->DateTime2);
	pDC->SelectObject( &OldFont );
	pDC->SetTextColor( GOldRGB );
}

/////////////////////////////////////////////////////////////////////////////
// CStringView diagnostics

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

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

CWgl_32Doc* CStringView::GetDocument()
{ 
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CWgl_32Doc)));
	return (CWgl_32Doc*) m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CStringView message handlers

BOOL CStringView::PreCreateWindow(CREATESTRUCT& cs) 
{
    CBrush NewBrush;
    LOGBRUSH lb;
    lb.lbStyle = BS_SOLID;
    lb.lbColor = RGB(64,128,128);
    
    NewBrush.CreateBrushIndirect(&lb);
    
	cs.lpszClass = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW, 
		AfxGetApp()->LoadStandardCursor(IDC_ARROW), NewBrush);//(HBRUSH)GetStockObject(BLACK_BRUSH));
	NewBrush.DeleteObject();
	return CView::PreCreateWindow(cs);	
}

/////////////////////////////////////////////////////////////////////////////
// CStringView Command handlers

void CStringView::OnActivateView(BOOL bActivate, CView* pActivateView, CView* pDeactiveView) 
{
	CSplitterWnd *pWnd = (CSplitterWnd *)GetParent();
	pWnd->SetActivePane(0,1);
}

⌨️ 快捷键说明

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