简单画图板设计报告Word格式.docx
- 文档编号:19275793
- 上传时间:2023-01-05
- 格式:DOCX
- 页数:29
- 大小:209.46KB
简单画图板设计报告Word格式.docx
《简单画图板设计报告Word格式.docx》由会员分享,可在线阅读,更多相关《简单画图板设计报告Word格式.docx(29页珍藏版)》请在冰豆网上搜索。
MainFrm.h"
我的画图板加强版Doc.h"
我的画图板加强版View.h"
#ifdef_DEBUG
#definenewDEBUG_NEW
#undefTHIS_FILE
staticcharTHIS_FILE[]=__FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
//CMyApp
BEGIN_MESSAGE_MAP(CMyApp,CWinApp)
//{{AFX_MSG_MAP(CMyApp)
ON_COMMAND(ID_APP_ABOUT,OnAppAbout)
//NOTE-theClassWizardwilladdandremovemappingmacroshere.
//DONOTEDITwhatyouseeintheseblocksofgeneratedcode!
//}}AFX_MSG_MAP
//Standardfilebaseddocumentcommands
ON_COMMAND(ID_FILE_NEW,CWinApp:
:
OnFileNew)
ON_COMMAND(ID_FILE_OPEN,CWinApp:
OnFileOpen)
//Standardprintsetupcommand
ON_COMMAND(ID_FILE_PRINT_SETUP,CWinApp:
OnFilePrintSetup)
END_MESSAGE_MAP()
//CMyAppconstruction
CMyApp:
CMyApp()
{
//TODO:
addconstructioncodehere,
//PlaceallsignificantinitializationinInitInstance
}
//TheoneandonlyCMyAppobject
CMyApptheApp;
//CMyAppinitialization
BOOLCMyApp:
InitInstance()
AfxEnableControlContainer();
//Standardinitialization
//Ifyouarenotusingthesefeaturesandwishtoreducethesize
//ofyourfinalexecutable,youshouldremovefromthefollowing
//thespecificinitializationroutinesyoudonotneed.
#ifdef_AFXDLL
Enable3dControls();
//CallthiswhenusingMFCinasharedDLL
#else
Enable3dControlsStatic();
//CallthiswhenlinkingtoMFCstatically
//Changetheregistrykeyunderwhichoursettingsarestored.
Youshouldmodifythisstringtobesomethingappropriate
//suchasthenameofyourcompanyororganization.
SetRegistryKey(_T("
LocalAppWizard-GeneratedApplications"
));
LoadStdProfileSettings();
//LoadstandardINIfileoptions(includingMRU)
//Registertheapplication'
sdocumenttemplates.Documenttemplates
//serveastheconnectionbetweendocuments,framewindowsandviews.
CSingleDocTemplate*pDocTemplate;
pDocTemplate=newCSingleDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(CMyDoc),
RUNTIME_CLASS(CMainFrame),//mainSDIframewindow
RUNTIME_CLASS(CMyView));
AddDocTemplate(pDocTemplate);
//Parsecommandlineforstandardshellcommands,DDE,fileopen
CCommandLineInfocmdInfo;
ParseCommandLine(cmdInfo);
//Dispatchcommandsspecifiedonthecommandline
if(!
ProcessShellCommand(cmdInfo))
returnFALSE;
//Theoneandonlywindowhasbeeninitialized,soshowandupdateit.
m_pMainWnd->
ShowWindow(SW_SHOW);
UpdateWindow();
SetWindowText("
软工二班尹异倾情打造"
);
//输出窗口的名称
returnTRUE;
//CAboutDlgdialogusedforAppAbout
classCAboutDlg:
publicCDialog
public:
CAboutDlg();
//DialogData
//{{AFX_DATA(CAboutDlg)
enum{IDD=IDD_ABOUTBOX};
//}}AFX_DATA
//ClassWizardgeneratedvirtualfunctionoverrides
//{{AFX_VIRTUAL(CAboutDlg)
protected:
virtualvoidDoDataExchange(CDataExchange*pDX);
//DDX/DDVsupport
//}}AFX_VIRTUAL
//Implementation
protected:
//{{AFX_MSG(CAboutDlg)
//Nomessagehandlers
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
CAboutDlg:
CAboutDlg():
CDialog(CAboutDlg:
IDD)
//{{AFX_DATA_INIT(CAboutDlg)
//}}AFX_DATA_INIT
voidCAboutDlg:
DoDataExchange(CDataExchange*pDX)
CDialog:
DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAboutDlg)
//}}AFX_DATA_MAP
BEGIN_MESSAGE_MAP(CAboutDlg,CDialog)
//{{AFX_MSG_MAP(CAboutDlg)
//Appcommandtorunthedialog
voidCMyApp:
OnAppAbout()
CAboutDlgaboutDlg;
aboutDlg.DoModal();
//CMyAppmessagehandlers
[2]我的画图板加强版View.cpp
LineWidth.h"
MYFONT.h"
#include"
LineStyle.h"
BrushStyle.h"
externintlinewidth;
externintlinestyle;
//CMyView
IMPLEMENT_DYNCREATE(CMyView,CView)
BEGIN_MESSAGE_MAP(CMyView,CView)
//{{AFX_MSG_MAP(CMyView)
ON_COMMAND(ID_LINE,OnLine)
ON_COMMAND(ID_RECTANGLE,OnRectangle)
ON_COMMAND(ID_ELLIPSE,OnEllipse)
ON_COMMAND(ID_LINEWIDTH_TWO,OnLinewidthTwo)
ON_COMMAND(ID_LINEWIDTH_THREE,OnLinewidthThree)
ON_COMMAND(ID_LINEWIDTH_FIVE,OnLinewidthFive)
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_COMMAND(ID_RED_COLOR,OnRedColor)
ON_COMMAND(ID_BULE_COLOR,OnBuleColor)
ON_COMMAND(ID_GREEN_COLOR,OnGreenColor)
ON_COMMAND(ID_USERDIFINED_COLOR,OnUserdifinedColor)
ON_COMMAND(ID_USERDIFINED_LINEWIDTH,OnUserdifinedLinewidth)
ON_COMMAND(ID_MYFONT,OnMyfont)
ON_COMMAND(ID_USERDEFINED,OnUserdefined)
ON_WM_MOUSEMOVE()
ON_COMMAND(ID_DLINE,OnDline)
ON_COMMAND(ID_USERDEFINEDBRUSH,OnUserdefinedbrush)
ON_COMMAND(ID_ROUNDRECTANGLE,OnRoundrectangle)
ON_COMMAND(ID_PIE,OnPie)
ON_COMMAND(ID_DELETE,OnDelete)
ON_COMMAND(ID_FILLCOLOR,OnFillcolor)
//Standardprintingcommands
ON_COMMAND(ID_FILE_PRINT,CView:
OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT,CView:
ON_COMMAND(ID_FILE_PRINT_PREVIEW,CView:
OnFilePrintPreview)
//CMyViewconstruction/destruction
CMyView:
CMyView()
{lw=1;
r=0;
g=0;
b=0;
tag=false;
loop=1;
addconstructioncodehere
m_clean=false;
~CMyView()
BOOLCMyView:
PreCreateWindow(CREATESTRUCT&
cs)
ModifytheWindowclassorstylesherebymodifying
//theCREATESTRUCTcs
returnCView:
PreCreateWindow(cs);
//CMyViewdrawing
voidCMyView:
OnDraw(CDC*pDC)
CMyDoc*pDoc=GetDocument();
ASSERT_VALID(pDoc);
m_clean)//m_clean是一个标志判断是否清空屏幕。
{
if(loop==1)//loop是一个标志判断为画笔还是画刷。
{CPenPen;
Pen.CreatePen(m_linestyle,lw,(m_color));
CPen*pOldPen=pDC->
SelectObject(&
Pen);
if(flag==1)//画线。
{pDC->
MoveTo(start);
pDC->
LineTo(end);
}
elseif(flag==2)//画矩形
{pDC->
Rectangle(start.x,start.y,end.x,end.y);
elseif(flag==3)//画椭圆
Ellipse(start.x,start.y,end.x,end.y);
if(flag==4)//铅笔画线
MoveTo(start1);
LineTo(end1);
if(flag==5)//画圆角矩形
RoundRect(start.x,start.y,end.x,end.y,25,25);
if(flag==6)//画饼图
Pie(start.x,start.y,end.x,end.y,100,200,300,400);
if(flag==7)填充色彩
{CBrushbrush;
brush.CreateSolidBrush(m_color);
CBrush*poldbrush=pDC->
brush);
FloodFill(start.x,start.y,m_color);
SelectObject(brush);
if(flag==8)//输出文本框
{
CFontmyFont;
myFont.CreateFont(8+8*m_size,0,0,0,400,
FALSE,FALSE,0,
ANSI_CHARSET,
OUT_DEFAULT_PRECIS,
CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY,
DEFAULT_PITCH|FF_SWISS,"
Arial"
CFont*pOldFont=pDC->
myFont);
pDC->
SetBkMode(TRANSPARENT);
SetTextColor(m_color);
TextOut(start.x,start.y,m_text);
DeleteObject(Pen);
elseif(loop==2)//实用画刷
{CBrushBr;
Br.CreateSolidBrush(m_color);
Br);
if(flag==1)
elseif(flag==2)//填充矩形
elseif(flag==3)//填充椭圆
if(flag==5)//填充圆角矩形
if(flag==6)//填充饼图
{pDC->
if(flag==7)//填充颜色
brush.CreateSolidBrush(m_color);
SelectObject(poldbrush);
DeleteObject(Br);
}//TODO:
adddrawcodefornativedatahere
m_clean=false;
//CMyViewprinting
OnPreparePrinting(CPrintInfo*pInfo)
//defaultpreparation
returnDoPreparePrinting(pInfo);
OnBeginPrinting(CDC*/*pDC*/,CPrintInfo*/*pInfo*/)
addextrainitializationbeforeprinting
OnEndPrinting(CDC*/*pDC*/,CPrintInfo*/*pInfo*/)
addcleanupafterprinting
//CMyViewdiagnostics
AssertValid()const
CView:
AssertValid();
Dump(CDumpContext&
dc)const
Dump(dc);
CMyDoc*CMyView:
GetDocument()//non-debugversionisinline
ASSERT(m_pDocument->
IsKindOf(RUNTIME_CLASS(CMyDoc)));
return(CMyDoc*)m_pDocument;
#endif//_DEBUG
//CMyViewmessagehandlers
OnLine()
{
flag=1;
Addyourcommandhandlercodehere
OnRectangle()
flag=2;
voidCMy
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 简单 画图板 设计 报告