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

📄 dv_view.cpp

📁 是一本很经典的书
💻 CPP
字号:
///////////////////////////////////////////////////////////////////
// Module  : DV_VIEW.CPP
//
// Purpose : Implementation of the CDocView1View class.
//
// Author  : Rob McGregor - rob_mcgregor@compuserve.com
//
// Date    : 05-12-96
///////////////////////////////////////////////////////////////////

#include "stdafx.h"     // Standard include
#include "DocView1.h"   // Application
#include "DV_Doc.h"     // Document
#include "DV_View.h"    // View

#include <colors.h>     // Assorted COLORREF colors

IMPLEMENT_DYNCREATE(CDocView1View, CView)

// Message Map for CDocView1View
BEGIN_MESSAGE_MAP(CDocView1View, CView)
   ON_WM_LBUTTONDOWN()
END_MESSAGE_MAP()

void CDocView1View::OnLButtonDown(UINT nFlags, CPoint point)
{
   MessageBeep(MB_ICONASTERISK);
   MessageBox("A minimal document/view MFC application", "About",
              MB_OK | MB_ICONINFORMATION);
}

///////////////////////////////////////////////////////////////////
// CDocView1View construction/destruction

CDocView1View::CDocView1View()
{
}

CDocView1View::~CDocView1View()
{
}

///////////////////////////////////////////////////////////////////
// CDocView1View drawing

void CDocView1View::OnDraw(CDC* pDC)
{
	//
   // Typically, you get a pointer to the document and then use it
   // to render the document's data onto the DC. We have no document
   // data to render, so we'll won't get the doc pointer, but we
   // could do so like this: 
   //
   //    CDocView2Doc* pDoc = GetDocument();
   //

   // Save the current state of the DC
   pDC->SaveDC();
   
   //
   // Draw an ellipse to fill the client area
   //
   CRect rc;
   GetClientRect(&rc);

   int nWidth  = rc.Width();
   int nHeight = rc.Height();

   // Create a gray brush and select it into the DC
   CBrush br(crGray);
   pDC->SelectObject(&br);

   // Draw the ellipse
   pDC->Ellipse(0, 0, nWidth, nHeight);

   // Restore the saved DC state
   pDC->RestoreDC(-1);
}
   

⌨️ 快捷键说明

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