hello.cpp

来自「MFC Windows 程序设计源代码,有实用价值」· C++ 代码 · 共 59 行

CPP
59
字号
#include <afxwin.h>
#include "Hello.h"
#include "stdafx.h"

CMyApp myApp;

/////////////////////////////////////////////////////////////////////////
// CMyApp member functions

BOOL CMyApp::InitInstance ()
{
    m_pMainWnd = new CMainWindow;
    m_pMainWnd->ShowWindow (m_nCmdShow);

	m_pMainWnd->UpdateWindow ();
    return TRUE;
}

/////////////////////////////////////////////////////////////////////////
// CMainWindow message map and member functions

BEGIN_MESSAGE_MAP (CMainWindow, CFrameWnd)
    ON_WM_PAINT ()
END_MESSAGE_MAP ()

CMainWindow::CMainWindow ()
{
    Create (NULL, _T ("The Hello Application"),WS_OVERLAPPEDWINDOW|WS_VSCROLL,CRect(0,64,354,602));
}

void CMainWindow::OnPaint ()
{
  //  CPaintDC dc (this);
	CPaintDC dc (this);
	
	
    
   CRect rect;
    GetClientRect (&rect);/* 
//	dc.SetROP2(R2_NOT);
//	dc.SetMapMode(MM_LOMETRIC);
//	
	dc.Ellipse(0,0,500,300);
//	dc.SetTextColor(RGB(255,255,0));
//	dc.SetBkColor(RGB(255,0,0));
	//dc.SetBkMode(TRANSPARENT);

    dc.DrawText (_T ("Hello, MFC"), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
	*/
    dc.SetMapMode(MM_ISOTROPIC);
	dc.SetWindowExt(500,500);
	dc.SetViewportExt(rect.Width(),rect.Height());
    dc.Ellipse(0,0,400,400);
	
	

}

⌨️ 快捷键说明

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