版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
地形可視化實習(xí)要點二
Visualc++簡單編程介紹
"開始”第?◎?眄MyTest-Mi..一)我QWC檔|周8Hcroso£tP」@AdobePhoto..|⑥31nternet..?RealPlay-:..||圜|(「〈?.QI9;皎
聃|GetConvexHull11國曝
?l曲
ApplicationtypeofMyTest:
MultipleDocumentInterfaceApplicationtargeting:
Win32
Classestobecreated:
Application:CMyTestAppinMyTest.handMyTestcpp
Frame:CMainFrameinMainFrm.handMainFrm.cpp
MDIChildFrame:CChildFrameinChildFrm.handChildFrm.cpp
Document:CMyTestDocinMyTestDoc.handMyTestDoc.cpp
View:CMyTestViewinMyTestView.handMyTestView.t^p
Features:
+Initialtoolbarinmainframe
+Initialstatusbarinmainframe
+PrintingandPrintPreviewsupportinview
+3DControls
+UsessharedDLLimplementation(MFC42.DLL)
+ActiveXControlssupportenabled
+Localizabletextin:
中文仲國1
ProjectDirectory:
D:\MyTest
Cancel
Ready
"開始「第?◎?l廚MyTest-Mi..一,我的文檔I國MicrosoftP|QAdobePhoto.?3工ntexnet..RealPlayer:.j哥I?直目|9:44
"開始”第?◎?眄MyTest-Mi..一,我QWC檔|網(wǎng)MicrosoftP|@AdobePhoto.|?3工ntexnet..▼1?RealPlayer:...||畫]
(日?.QI。;45
lyTest-licrosoftVisualC++
FileEditViewInsertProjectBuildToolsVindowHelp
窗|.x.題扃二一一「嗎區(qū)1西|GetConvexHull▼仍必Lf國喈富。嗖?片/*〃11為限
(GlobalsJ(AllglobalmembersjJ||Nomembers-CreateNewClass...)?X、▼慳曜昌!副通
--------------------------------------------------------------------------ijJx
B《
E飛CAboutDIg
t亙飛CChildFrame
t!.巳CMainFrame
+*,?CMyTestApp
t1飛CMyTestDoc
+飛CMyTestView
SLJGlobals
EClassView]幽ResourceView]圉FileView]
4q
JJ.LRBui類Id/Debug\FindmFiles1XFindinFiles7.\ResultsJtJ_]?|-
Ready
才開始|I劭0易》|MyTest-Mi..~~一,我覘T檔|罔桁croso£tP?|@AdobePhoto.@31ntexnet..▼[?RealPlayer.|哥|(|??廷目|9:48
***/ByTest一licrosoftVisualC+4-[iyTestView.cpp]
中MyTestView.cppD.\fflyTest\MyTestView.cpp
臼摩MyTestclasses//}}AFXJ1SGJ1AP
?*4CAboutDIg//Standardprintingcommands
由■胃CChildFrame0H_C0MMAND(ID_FILE_PRINT,CUiew::OnFilePrint)
ONZCOHHAND(ID^FILE^PRINT_DIRECT,CUiew::OnFilePrint)
團(tuán)■巴CMainFrame
OHZCOMMAND(ID^FILE^PRINTZPREUIEW,CUiew::OnFilePrintPreuiew)
S飛CMyTesSppENDJ1ESSAGEJ1AP()
3CMyTestDoc
日■3CMyTestView/////////////////////////////////////////////////////////////////////////////
AssertValidp//CI'1yTestUiev>construction/destruction
CMyTestView|
?~CMyTestVievMyTestUiew::CMyTestUiew()
?Dump(CDump
0:addconstructioncodehere
?GetDocument
OnBeginPrinti
?OnDraw(CDC雙擊函數(shù)名,打開cpp'文
$.OnEndPrintiniCMyTestUiew::^CMyTestUiei^)
為OnPreparePri件,定位到該函數(shù)體/
?PreCreateWin
?LJGlobals
BOOLCMyTestUiew::PreCreateWindow(CREATESTRUCT&cs)
//TODO:ModifytheWindowclassorstyleshe?-ebymodifying
//theCREATESTRUCTcs
returnCUieu::PreCreateWindow(cs);
?
11/////////////////////////////////////////////////////////////////////////////
r*<*M*.*v*——JL.IIJ---一一?
Re...凰Fil…
▲
縮放源程序窗口
J?Build/Debug'FindinFiles14FindinFilgs2XR&suLts
Ready
開始|繆?眉》11?9MyTest-Mi...」我的文檔IJE]MicrosoftP..|QAdobePhoto..|眉3工nternet..4^RealPlayer:...|回|,~10:21
***/lyTest一licrosoftVisualC++-|g|x|
FileEditViewinsertProjectBuildToolsWindowjjelp
置辭「能?,—M國留聃河etConvexHull2J?u爐電毛力圖答廄電魄『中/*》、到國取
|CMyTestViewclassmembers)▼^CMyTestView圜:盾!薊州
J*1
臼尊MyTestclasses
?pCAboutDIg
//>>AFX_MSG_HAP3
由■胃CChildFrameclassCMyTestUiew:publicCUiew//Standardprintingcommands
由FCMainFrameON_COI1HftND(ID_F1LE_PRINT,CUiew::OnFilePri
S飛CMyTesSppprotected://createFromserializationonlyON二COMMAND(ID二F1LE二PRINT_DIRECT,CUidu::0r
3CMyTestDocCMyTestUiew();ON二COMMAND(ID二FILE二PRINT二PREUIEW,CUiew::(
DECLARE_DVNCREATE(CMyTestUiew)END_MESSAGE_MAP()~/
日■3CMyTestView
?AssertValii
//Attributes/////////////////////////////////////////////y
9?|CMyTestVi
public://CMyTestUiewconstruction/destructj^on
??CMyTestVCMyTestDoc*GetDocunent();
?Dump(CDuCMyTestUiew::CMyTestUiev/()
?GetDocum//Operations
OnBeginPipublic://TODO:addconstructioncode7here
?OnDraw(C[
//Ouerrides
OnEndPrin
//ClassWizardgenerateduirtualFunctionou
小?OnPrepare
//<<AFX_UIRTUfiL(CMyTestUiew)CMyTestUiew:z^CMyTestUiewt)
?PreCreateSpublic:
田口GlobalsuirtualuoidOnDraw(CDC*pDC);//ouerriddei
uirtualBOOLPreCreateWindow(CREfiTESTRUCT6c:
protected:BOOLCMyTestUiew::PreCreatet|{ndow(CREATESTRUCl
virtualBOOLOnPreparePrinting(CPrintInFo*p
uirtualvoidOnBeginPrinting(CDC*pDCvCPrin//TODO:ModifytheWindowclassorstyle*
virtualuoidOnEndPrintingCCDC*pDCyCPrintli//theCREATESTRUCTqs
〃}}AFXUIRTUAL
returnCUiew::PreCre^teV^indov/(cs);
?〃Implementation
回N…
圄Fi...L11U2d
縮放源程序窗口
11?Build/DebugXFindinFiles1XFindinFiles2XResultsj|<|
ReadyILn16,Col19|REC[COL|OVR|READ
開始|繆眉》」我的文檔
?||?9MyTest-Mi...I同MicrosoftP..|⑥AdobePhoto.3Internet.?RealPlayer:...I|圜,回|?[?10:23
***/lyTest一licrosoftVisualC++-|g|x|
FileEditViewinsertProjectBuildToolsWindowjjelp
置4IH7?電i=0因留%|GetConvexHull三]|扁k電A4國吟蜜{)?m片"〃句為暇
|CMyTestViewEgilclassmembers)▼|[8.CMyTestView三]魚,季圜縣!頊州
J*1■yTestViev.h&■yTirstViewcpg>-1□!x|
臼尊MyTestclasses寺CMyTestViewICView
?*4CAboutDIg
3//>>AFX_MSG_HAP
由■胃CChildFrame//Ouerrides//Standardprintingcommands
由FCMainFrame//ClasswizardgenerateduirtualFunctionou(ON_COI1HftND(ID_F1LE_PRINT,CUiew::OnFilePri
S飛CMyTesSpp//<<AFX_UIRTUAL(CMyTestUiew)ON二COMMAND(ID二F1LE二PRINT_DIRECT,CUiew::0r
3CMyTestDocpublic:ON二COMMAND(ID二FILE二PRINT二PREUIE*CUiew::(
uirtualuoidOnDraw(CDC*pDC);//ouerriddei
日■3CMyTestViewENDMESSAGEJIAPO
uirtualBOOLPreCreateWindow(CREATESTRUCT&c:
?AssertValii
protected://///////////////////////////////////////////y
CMyTestViuirtualBOOLOnPreparePrinting(CPrintInFo*p//CMyTestUiewconstruction/destruction
??CMyTestV
virtualuoidOnBeginPrinting(CDC?pDCvCPrin
?Dump(CDuuirtualuoidOnEndPrinting(CDC*pDC,CPrintliCMyTestUiew::CMyTestUiev/()
?GetDocum//>>AFX_UIRTUfiL
OnBeginPi//TODO:addconstructioncodehere
?OnDraw(C(Implementation
public:
為OnEndPrin
uirtual^CMyTestUiew();
為OnPrepare
ttiFdef_DEBUGCMyTestUiew:z^CMyTestUiewt)
?PreCreateSuirtualuoidftssertUalid()const;
?QGlobalsuirtualuoidDump(CDunpContext&(1c)const;
ttendiF
BOOLCMyTestUiew::PreCreateWindow(CREATESTRUCl
protected:
//TODO:ModifytheWindowclassorstyle*
//GeneratednessagenapFunctions//theCREATESTRUCTcs
protected:
//<<AFX_MSG(CMyTestUiew)returnCUiew::PreCreateV^indow(cs);
?//NOTE-theClasswizardwilladdand門周}
hONOTPhITmhst-nnticooir?t*hoco
凰Fi…L11UL11U2d
.
IZEkBuild/:D?huEkFibdiirFileis1XFindixiFilQs2'Results"'4||
2?
Ready[Ln16,Col19|REC[COL|OVR|READ
j國MicrosoftP..10AdobePhoto.163▼|。RealPlayer:..||曷|②|?[
"開始|◎⑥油"11??MyTest-Mi...」我的文檔Internet.?10:27
***/lyTest一licrosoftVisualC++-|g|x|
FileEditViewinsertProjectBuildToolsWindowjjelp
置;自易圖|>船里|工”口;因杏聃|GetConvexHull-3I'M少場A冷國曾蜜{}眠期%/*〃引c旬限
lewclassmembers)^]CMyTestView三I區(qū),季圜縣!頊州
二」X
EiSp]MyTestclasses
3B飛CAboutDIg//>>AFX_MSG_HAP
由■:CChildFrame//Ouerrides-//Standardprintingcommands3
田CMainFrame//ClasswizardgenerateduirtualFunctionouiON_COI1HftND(ID_F1LE_PRINT,CUiew::OnFilePri
田飛CMyTesSpp//<<AFX_UIRTUAL(CMyTestUiew)ON二COMMAND(ID二F1LE二PRINT_DIRECT,CUiew::0r
田,1;CMyTestDocpublic:ON二COMMAND(ID二FILE二PRINT二PREUIE*CUiew::(
virtualuoidOnDraw(CDC*pDC);//ouerriddei
日■,CMyTestViewENDMESSAGEJIAPO
uirtualBOOLPreCreateWindow(CREATESTRUCT&c:
?AssertValii
protected://///////////////////////////////////////////y
釧CMyTestViuirtualBOOLOnPreparePrinting(CPrintInFo*p//CMyTestUiewconstruction/destruction
??CMyTestV
virtualuoidOnBeginPrinting(CDC?pDCvCPrin
?Dump(CDuuirtualuoidOnEndPrinting(CDC*pDC,CPrintliCMyTestUiew::CMyTestUiev/()
?GetDocum//>>AFX_UIRTUfiL
OnBeginPi//TODO:addconstructioncodehere
?OnDraw(C[//Inple析構(gòu)函數(shù)
%OnEndPrin
uirtual^CMyTestUiew();
gOnPrepare
ttiFDEBUGCMyTestUiew:z^CMyTestUiewt)
?PreCreateSuioidAid()const;
ElQGlobalsuirtualuoidDump(CDunpContext&j)const;
ttendiF
ateWindow(CREATESTRUCl
protected:
//TODO:ModifytheWindowclassorstyle*
//GeneratednessagenapFunctions//theCREATESTRUCTcs
protected:
//<<AFX_MSG(CMyTestUiew)returnCUiew::PreCreateV^indov/(cs);
41?//NOTE-theClasswizardwilladdandr??
hONOTPhITmhst-nnticooir?t*hoco
弱R…圄Fi...L11UL11U2d
ABuild/"DebugtFindinFiles13FindinFiles2\Results】<|2?
Ready[Ln16,Col19(REC[COL|OVR(READ
上開始I繆0Q?I【SMyTest-Mi…」我的文檔I周MicrosoftP..J0AdobePhoto.3Internet.▼]RealPlayer:.I哥回I10:27
iyTest-[lyTestl]
常用消息與函數(shù)
■消息函數(shù)
?與ID直接掛鉤
?不與ID直接掛鉤
■類成員函數(shù)(自定義函數(shù))
***/ByTest一licrosoftVisualC+4-[iyTestView.cpp]-|g|X|
l?l£ileEditView工nsertProjectguildlools也-|g|x|
固辱甚能宅國西聃
GA1-I0|GetConvexHull|M少場A冷國曾唱{}崛a%/*〃2c旬啾
jCMyTestView^||(Allclassmembers)^||^OnPrepareDC奧▼骸圜馬!:虱州
J*1中MyTestView.cppD:\MyTest\MyTestView.cpp
臼尊MyTestclassesCUievj::AssertUalid();
?*4CAboutDIg
由■胃CChildFrame
uoidCMyTestUievj::Duiup(CDumpContext&de)const
由FCMainFrame
S飛CMyTesSppCUiew::Dunp(dc);
3CMyTestDoc
日弋CMyTestView
AssertValiiCMyTestDoc*CMyTestUiew::GetDocument()//non-debuguersionisinline
爽CMyTestVi<
??CMyTesWASSERT(mpDocunent->IsKindOf:(RUNTIME_CLASS(CMyTestDoc)));
?Dump(CDureturn(CMyTestDoc*)npDocument;
?GetDocum}
ttendif//__DEBUG
OnBeginPi
?OnDraw(C[/////////////////////////////////////////////////////////////////////////////
OnEndPrin〃CMuTestUiewmessaqehandlers
?OnPrepare
2*OnPrepareuoidCMyTestUiew::OnPrepareDC(CDC*-iDC,CPrintlnFo*plnfo)
?PreCreateS
由LJGlobals//TODO:Addyourspecializedcodehereand/orcallthebaseclass
CUievj::OnPrepareDC(pDC9plnfo);
一T』準(zhǔn)備畫圖設(shè)備DC,每次刷新窗口時由程序自動調(diào)用立
二皿st4一0"。山|),為DnOraw準(zhǔn)備DC,然后將^pDC傳遞給OnDraw畫圖
\<I?BuildkDepug入FindinFiles11FindinFilers2XResults】|“|,J
ReadyILn110^01|HEC[COL|OVR|READ
開始|繆?眉》|MyTest-Mi...」我的文檔j國MicrosoftP..10AdobePhoto.163Internet.▼|?WindowsWed..|圜,⑦|?[?11:33
I、VisualC++6基本操作
4、繪圖方式與坐標(biāo)映射
voidC1cst\jew:'OnrrcpurcOC(C1.)CpD(,(.±rintliilo*
CRectrc;
GetClientRect(&rc);〃獲得視口矩形
intnWidth=10000;〃窗口關(guān)小
intnHeight=18000;
pDC->SetMapMode(MM_ISOTROPIC);〃映射模式
pDC->SetViewportOrg((rc.left+rc.right)/!,(rc.top+ix:botton^/^);〃視口原點
pDC->SetWindowOrg(0,0);〃窗口原點
pDC->SetViewportExt(rc.Width(),-rc.HeightO);〃視口寬、
pDC->SetWindowExt(nWidth,nHeight);〃窗口寬高
CViev::OnPrepareD('(pDC,plnfo);
}
就緒I一藏竽耐
,開始|◎⑥眉》ISMyTest-…|」我的文檔|回地形可視.|⑥AdobePh.|£21ntem…J?Windows|項MyTest|哥|②|?k12:01
***/ByTest-licrosoftVisualC++-[ByTestViev.cpp■]-|g|X|
?區(qū)I£ileEditViewInsertProjectguildToolsJ/indowHelp-Il5|X|
HP目|/電■|C:,|厄回官埠|GetConvexHuH-3|5|帕內(nèi).用圖鴛電電魄?q/*〃11閣間
jcMyTestView-classmembers)▼]1,OnPrepareDC-虱▼口檢圜士??班)
J*1中CMyTestView.OnPrepareDCvoidCMyTestView:.OnPrepareDC(CDC*pDC,CPrintlnfo*plnfo){
臼尊MyTestclassesCUiew::Dunp(dc);
?pCAboutDIg
由■胃CChildFrame
CMyTestDoc*CMyTestUievi::GetDocument()//non-debuguersionisinline
由FCMainFrame
S飛CMyTesSppASSERT(n_POocurnent->IsKindOF(RUNTIME_CLASS(CMyTestDoc)));
3CMyTestDocreturn(CMyTestDoc*)H_pDocument;
日弋CMyTestView
AssertValiittendiF//__DEBUG
爽CMyTestVi
??CMyTesW/////////////////////////////////////////////爍來妁地圖出標(biāo)系的原點
?Dump(CDu//CMyTestUiewmessagehandlers
?GetDocum
uoidCMyTestUiew::OnPrepareDC(CDC*pDC,A/二
OnBeginPiy
?OnDraw(C[//TODO:Addyourspecializedcodehereano/orcallthebaseclass
OnEndPrinCRectre;
?OnPrepareGetClieniRect(&「,):〃獲得視口矩形?__,tr.t、r
2*OnPrepareintnWidth=18060;〃窗口大小IS\占
?PreCreateSintnHeight=18080;/3qF'i'*I-l'>
由LJGlobalspDC->SetMapMode(MMANISOTROPICjT〃映射模式\f
li)OC->SetUiewoortOra((「「.left*;GiW孤?潭吧ttQFQ/2):〃視口原點
pDC->SetWindowOrg(0,0);〃密日康點
pDC->SetUiewportExt(rc.Width()?-rc.HeightO);〃視口寬、高
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 浙江經(jīng)濟(jì)職業(yè)技術(shù)學(xué)院《房地產(chǎn)市場理論與實務(wù)》2023-2024學(xué)年第一學(xué)期期末試卷
- 中國礦業(yè)大學(xué)《中醫(yī)經(jīng)典綜合實訓(xùn)》2023-2024學(xué)年第一學(xué)期期末試卷
- 浙大寧波理工學(xué)院《材料與成型》2023-2024學(xué)年第一學(xué)期期末試卷
- 棗莊職業(yè)學(xué)院《塑性加工力學(xué)》2023-2024學(xué)年第一學(xué)期期末試卷
- DB2201T 70-2024 非洲豬瘟病毒環(huán)境監(jiān)測采樣技術(shù)規(guī)范
- 數(shù)學(xué)游戲演講模板
- 專業(yè)案例(暖通空調(diào)專業(yè))-公用設(shè)備工程師(暖通空調(diào)專業(yè))《專業(yè)案例》押題密卷
- 生命起源理論教學(xué)
- 七夕節(jié)青年營銷策略
- 二零二五版交通事故傷殘鑒定及賠償協(xié)議3篇
- 鋼結(jié)構(gòu)施工管理培訓(xùn)課件
- 2024年度工程建設(shè)項目安全評價合同2篇
- 《飛機(jī)操縱面》課件
- 商業(yè)咨詢報告范文大全
- 自我發(fā)展與團(tuán)隊管理課件
- 《婦產(chǎn)科學(xué)》課件-17.盆腔器官脫垂
- 監(jiān)理報告范本
- 店鋪交割合同范例
- 大型活動LED屏幕安全應(yīng)急預(yù)案
- 2024年內(nèi)蒙古包頭市中考道德與法治試卷
- 湖南省長沙市2024-2025學(xué)年高二上學(xué)期期中考試地理試卷(含答案)
評論
0/150
提交評論