• 大小: 143KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-27
  • 语言: C/C++
  • 标签: MFC  线段裁剪  

资源简介

该资源是学生对MFC、C++和数据结构的实践,需求为实现画矩形和画直线,然后实现裁剪、颜色选取、清空功能。 程序添加了注释,看起来层次非常清晰。

资源截图

代码片段和文件信息

// DrawRectangle.cpp : Defines the class behaviors for the application.
//

#include “stdafx.h“
#include “DrawRectangle.h“

#include “MainFrm.h“
#include “DrawRectangleDoc.h“
#include “DrawRectangleView.h“

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

/////////////////////////////////////////////////////////////////////////////
// CDrawRectangleApp

BEGIN_MESSAGE_MAP(CDrawRectangleApp CWinApp)
//{{AFX_MSG_MAP(CDrawRectangleApp)
ON_COMMAND(ID_APP_ABOUT OnAppAbout)
// 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
// Standard file based document commands
ON_COMMAND(ID_FILE_NEW CWinApp::OnFileNew)
ON_COMMAND(ID_FILE_OPEN CWinApp::OnFileOpen)
// Standard print setup command
ON_COMMAND(ID_FILE_PRINT_SETUP CWinApp::OnFilePrintSetup)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CDrawRectangleApp construction

CDrawRectangleApp::CDrawRectangleApp()
{
// TODO: add construction code here
// Place all significant initialization in InitInstance
}

/////////////////////////////////////////////////////////////////////////////
// The one and only CDrawRectangleApp object

CDrawRectangleApp theApp;

/////////////////////////////////////////////////////////////////////////////
// CDrawRectangleApp initialization

BOOL CDrawRectangleApp::InitInstance()
{
AfxEnableControlContainer();

// Standard initialization
// If you are not using these features and wish to reduce the size
//  of your final executable you should remove from the following
//  the specific initialization routines you do not need.

#ifdef _AFXDLL
Enable3dControls(); // Call this when using MFC in a shared DLL
#else
Enable3dControlsStatic(); // Call this when linking to MFC statically
#endif

// Change the registry key under which our settings are stored.
// TODO: You should modify this string to be something appropriate
// such as the name of your company or organization.
SetRegistryKey(_T(“Local AppWizard-Generated Applications“));

LoadStdProfileSettings();  // Load standard INI file options (including MRU)

// Register the application‘s document templates.  Document templates
//  serve as the connection between documents frame windows and views.

CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
IDR_MAINframe
RUNTIME_CLASS(CDrawRectangleDoc)
RUNTIME_CLASS(CMainframe)       // main SDI frame window
RUNTIME_CLASS(CDrawRectangleView));
AddDocTemplate(pDocTemplate);

// Parse command line for standard shell commands DDE file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;

// The one and only window has been initial

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      44696  2011-04-27 10:59  DrawLine\DrawRectangle.aps

     文件       2530  2011-04-28 09:21  DrawLine\DrawRectangle.clw

     文件       4335  2011-04-26 17:41  DrawLine\DrawRectangle.cpp

     文件       4758  2011-04-28 09:18  DrawLine\DrawRectangle.dsp

     文件        534  2011-04-26 17:41  DrawLine\DrawRectangle.dsw

     文件       1433  2011-04-26 17:41  DrawLine\DrawRectangle.h

     文件      74752  2011-04-28 09:21  DrawLine\DrawRectangle.ncb

     文件      50688  2011-04-28 09:21  DrawLine\DrawRectangle.opt

     文件       1220  2011-04-28 09:20  DrawLine\DrawRectangle.plg

     文件      12205  2011-04-27 10:59  DrawLine\DrawRectangle.rc

     文件       1882  2011-04-26 17:41  DrawLine\DrawRectangleDoc.cpp

     文件       1552  2011-04-26 17:41  DrawLine\DrawRectangleDoc.h

     文件      11230  2011-04-28 09:20  DrawLine\DrawRectangleView.cpp

     文件       2796  2011-04-28 09:16  DrawLine\DrawRectangleView.h

     文件        103  2011-04-28 07:39  DrawLine\Line.h

     文件       2514  2011-04-26 17:41  DrawLine\MainFrm.cpp

     文件       1581  2011-04-26 17:41  DrawLine\MainFrm.h

     文件       4479  2011-04-26 17:41  DrawLine\ReadMe.txt

     文件       1078  2011-04-26 17:41  DrawLine\res\DrawRectangle.ico

     文件        405  2011-04-26 17:41  DrawLine\res\DrawRectangle.rc2

     文件       1078  2011-04-26 17:41  DrawLine\res\DrawRectangleDoc.ico

     文件       1078  2011-04-27 10:52  DrawLine\res\Toolbar.bmp

     文件        835  2011-04-27 10:59  DrawLine\resource.h

     文件        215  2011-04-26 17:41  DrawLine\StdAfx.cpp

     文件       1054  2011-04-26 17:41  DrawLine\StdAfx.h

     目录          0  2011-04-27 10:52  DrawLine\res

     目录          0  2011-04-28 09:21  DrawLine

     文件     119477  2011-04-26 17:33  实验三.pdf

----------- ---------  ---------- -----  ----

               348508                    28

............此处省略1个文件信息

评论

共有 条评论