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

📄 derenger2.txt

📁 实现多行
💻 TXT
字号:
// DerEnger2View.cpp : implementation of the CDerEnger2View class
//

#include "stdafx.h"
#include "DerEnger2.h"

#include "DerEnger2Doc.h"
#include "DerEnger2View.h"

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

/////////////////////////////////////////////////////////////////////////////
// CDerEnger2View

IMPLEMENT_DYNCREATE(CDerEnger2View, CView)

BEGIN_MESSAGE_MAP(CDerEnger2View, CView)
	//{{AFX_MSG_MAP(CDerEnger2View)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDerEnger2View construction/destruction

CDerEnger2View::CDerEnger2View()
{
	// TODO: add construction code here

}

CDerEnger2View::~CDerEnger2View()
{
}

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

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CDerEnger2View drawing

void CDerEnger2View::OnDraw(CDC* pDC)
{
	 int nPosition = 0;

    for (int i = 6; i <= 24; i += 2) {
        ShowFont(pDC, nPosition, i);
    }
    TRACE("LOGPIXELSX = %d, LOGPIXELSY = %d\n",
          pDC->GetDeviceCaps(LOGPIXELSX),
          pDC->GetDeviceCaps(LOGPIXELSY)); 
    TRACE("HORZSIZE = %d, VERTSIZE = %d\n",
          pDC->GetDeviceCaps(HORZSIZE),
          pDC->GetDeviceCaps(VERTSIZE)); 
    TRACE("HORZRES = %d, VERTRES = %d\n",
          pDC->GetDeviceCaps(HORZRES),
          pDC->GetDeviceCaps(VERTRES));
	// TODO: add draw code for native data here
}

/////////////////////////////////////////////////////////////////////////////
// CDerEnger2View diagnostics

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

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

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

/////////////////////////////////////////////////////////////////////////////
// CDerEnger2View message handlers

void CDerEnger2View::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo) 
{
   pDC->SetMapMode(MM_ANISOTROPIC);
   pDC->SetWindowExt(1440,1440);
   pDC->SetViewportExt(pDC->GetDeviceCaps(LOGPIXELSX),
	                   -pDC->GetDeviceCaps(LOGPIXELSY));

}

void CDerEnger2View::ShowFont(CDC *pDC, int &nPos, int nPoints)
{
    TEXTMETRIC tm;
    CFont      fontText;
    CString    strText;
    CSize      sizeText;

    fontText.CreateFont(-nPoints * 20, 0, 0, 0, 400, FALSE, FALSE, 0,
                        ANSI_CHARSET, OUT_DEFAULT_PRECIS,
                        CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY,
                        DEFAULT_PITCH | FF_SWISS, "Arial");
    CFont* pOldFont = (CFont*) pDC->SelectObject(&fontText);
    pDC->GetTextMetrics(&tm);
    TRACE("points = %d, tmHeight = %d, tmInternalLeading = %d,"
          " tmExternalLeading = %d\n", nPoints, tm.tmHeight,
          tm.tmInternalLeading, tm.tmExternalLeading);
    strText.Format("This is %d-point Arial", nPoints);
    sizeText = pDC->GetTextExtent(strText);
    TRACE("string width = %d, string height = %d\n", sizeText.cx,
          sizeText.cy);
    pDC->TextOut(0, nPos, strText);
    pDC->SelectObject(pOldFont);
    nPos -= tm.tmHeight + tm.tmExternalLeading;
}

⌨️ 快捷键说明

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