mfcECGViewer.docx
- 文档编号:12467543
- 上传时间:2023-04-19
- 格式:DOCX
- 页数:17
- 大小:17.66KB
mfcECGViewer.docx
《mfcECGViewer.docx》由会员分享,可在线阅读,更多相关《mfcECGViewer.docx(17页珍藏版)》请在冰豆网上搜索。
mfcECGViewer
//ECGBackground.cpp:
implementationoftheCECGBackgroundclass.
//
//////////////////////////////////////////////////////////////////////
#include"stdafx.h"
#include"ECGViewer.h"
#include"ECGBackground.h"
#ifdef_DEBUG
#undefTHIS_FILE
staticcharTHIS_FILE[]=__FILE__;
#definenewDEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
//Construction/Destruction
//////////////////////////////////////////////////////////////////////
CECGBackground:
:
CECGBackground()
{CBitmapbmp;
bmp.LoadBitmap(IDB_BITMAP1);
m_brushBackground.CreatePatternBrush(&bmp);
}
CECGBackground:
:
~CECGBackground()
{
}
voidCECGBackground:
:
Draw(CDC*pDC,CRectrtDraw){
CPointx1=rtDraw.TopLeft();
CPointx2=rtDraw.BottomRight();
for(inti1=x1.y;i1 { CPenpen(PS_DOT,1,RGB(112,122,13)); CPen*pOldPen=pDC->SelectObject(&pen); pDC->MoveTo(x1.x,i1); pDC->LineTo(x2.x,i1); } for(intj1=x1.x;j1 CPenpen1(PS_DOT,1,RGB(0,0,112)); CPen*pOldPen=pDC->SelectObject(&pen1); pDC->MoveTo(j1,x1.y); pDC->LineTo(j1,x2.y); } } //ECGLeadView.cpp: implementationoftheCECGLeadViewclass. // ////////////////////////////////////////////////////////////////////// #include"stdafx.h" #include"ECGViewer.h" #include"ECGLeadView.h" #ifdef_DEBUG #undefTHIS_FILE staticcharTHIS_FILE[]=__FILE__; #definenewDEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// //Construction/Destruction ////////////////////////////////////////////////////////////////////// CECGLeadView: : CECGLeadView() { } CECGLeadView: : ~CECGLeadView() { } voidCECGLeadView: : Draw(CDC*pDC,CRectrtDraw) { pDC->Rectangle(rtDraw); m_ecgSingleLead.Draw(pDC,rtDraw); m_ecgBackground.Draw(pDC,rtDraw); } voidCECGLeadView: : ReadDataFile(CStringcsFile) { CStdioFilefile; if(! file.Open(csFile,CFile: : modeRead)) { return; } intnLength=file.GetLength(); BYTE*pBuf=newBYTE[nLength]; file.Read(pBuf,nLength); for(inti=0;i { if(i+2>nLength) { break; } intnLead1Temp1=pBuf[i]; i++; BYTEbyTemp=pBuf[i]; i++; intnLead2Temp1=pBuf[i]; intnLeadValue1=(byTemp&0x0F)*256+nLead1Temp1; intnLeadValue2=((byTemp&0xF0)>>4)*256+nLead2Temp1; m_ecgSingleLead.Add(nLeadValue1,i/3);m_ecgSingleLead.Add(nLeadValue2,(i/3)+1); m_ecgSingleLead.k=0;m_ecgSingleLead.l=0; } delete[]pBuf; file.Close(); } voidCECGLeadView: : Change() { m_ecgSingleLead.k+=10; } voidCECGLeadView: : Change1() { m_ecgSingleLead.l+=10; } //ECGPage.cpp: implementationoftheCECGPageclass. // ////////////////////////////////////////////////////////////////////// #include"stdafx.h" #include"ECGViewer.h" #include"ECGPage.h" #ifdef_DEBUG #undefTHIS_FILE staticcharTHIS_FILE[]=__FILE__; #definenewDEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// //Construction/Destruction ////////////////////////////////////////////////////////////////////// CECGPage: : CECGPage() { } CECGPage: : ~CECGPage() { } voidCECGPage: : Draw(CDC*pDC,CRectrtDraw) { CRectrtPatient(rtDraw); rtPatient.bottom=rtDraw.top+(0.35*rtDraw.Height()); CRectrtLeadView(rtDraw); rtLeadView.top=rtPatient.bottom; m_ecgPatientInfo.Draw(pDC,rtPatient); m_ecgLeadView.Draw(pDC,rtLeadView); } voidCECGPage: : ReadFile(fstream&file,CStringcsDatFile) { m_ecgPatientInfo.ReadPatientInfo(file); m_ecgPatientInfo.GetName(csDatFile); m_ecgLeadView.ReadDataFile(csDatFile); } voidCECGPage: : Change() { m_ecgLeadView.Change(); } voidCECGPage: : Change1() { m_ecgLeadView.Change1(); } //ECGPatientInfo.cpp: implementationoftheCECGPatientInfoclass. // ////////////////////////////////////////////////////////////////////// #include"stdafx.h" #include"ECGViewer.h" #include"ECGPatientInfo.h" #ifdef_DEBUG #undefTHIS_FILE staticcharTHIS_FILE[]=__FILE__; #definenewDEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// //Construction/Destruction ////////////////////////////////////////////////////////////////////// CECGPatientInfo: : CECGPatientInfo() { Sex=''; Age=0; } CECGPatientInfo: : ~CECGPatientInfo() { } voidCECGPatientInfo: : Draw(CDC*pDC,CRectrtDraw) {//CBitmapbit; //bit.LoadBitmap(bitmap1); CBrushbrush(RGB(120,150,125)); //CClientDCdc(this); pDC->SetBkColor(RGB(120,150,125)); pDC->FillRect(rtDraw,&brush); pDC->Rectangle(rtDraw); CStringstr1,b; b.Format("%d",Age); str1+="性别: "; str1+=Sex; str1+="年龄: "; str1+=b; pDC->TextOut(10,rtDraw.Height()/6*2,str1); str1=""; str1+="用药: "; str1+=Yongyao; str1+="手术: "; str1+=Shoushu; pDC->TextOut(10,rtDraw.Height()/6*3,str1); pDC->TextOut(10,rtDraw.Height()/6,"文件: "); pDC->TextOut(50,rtDraw.Height()/6,Name); } voidCECGPatientInfo: : GetName(CStringname){ Name=name;} voidCECGPatientInfo: : ReadPatientInfo(fstream&file) { charcsTest[100]; CStringcs1; file>>csTest; file>>Age; file>>Sex; file>>csTest; file>>csTest; file>>csTest; file>>csTest; file>>Yongyao; file>>Shoushu; } //ECGSingleLead.cpp: implementationoftheCECGSingleLeadclass. // ////////////////////////////////////////////////////////////////////// #include"stdafx.h" #include"ECGViewer.h" #include"ECGSingleLead.h" #ifdef_DEBUG #undefTHIS_FILE staticcharTHIS_FILE[]=__FILE__; #definenewDEBUG_NEW #endif ////////////////////////////////////////////////////////////////////// //Construction/Destruction ////////////////////////////////////////////////////////////////////// CECGSingleLead: : CECGSingleLead() { k=0; l=0; for(inti=0;i<650000;i++)cunchu[i]=0; } CECGSingleLead: : ~CECGSingleLead() { } voidCECGSingleLead: : Draw(CDC*pDC,CRectrtDraw){ CPointx1=rtDraw.TopLeft(); CPointx2=rtDraw.BottomRight(); for(inti=0;i<65000;i+=2){ pDC->MoveTo(i/2-k,x2.y-cunchu[i]*rtDraw.Height()/1500); pDC->LineTo((i+2)/2-k,(x2.y-cunchu[i+2]*rtDraw.Height()/1500)); } for(intj=1;j<65000;j+=2){ pDC->MoveTo((j/2)-l,x2.y-cunchu[j]*rtDraw.Height()/1500+rtDraw.Height()/2); pDC->LineTo((j+2)/2-l,x2.y-cunchu[j+2]*rtDraw.Height()/1500+rtDraw.Height()/2); } } voidCECGSingleLead: : Add(intx,inti){ if(i<650000)cunchu[i]=x; } voidCECGSingleLead: : Get(CRectrect){ whole=rect; } //ECGViewer.cpp: Definestheclassbehaviorsfortheapplication. // #include"stdafx.h" #include"ECGViewer.h" #include"MainFrm.h" #include"ChildFrm.h" #include"ECGViewerDoc.h" #include"ECGViewerView.h" #ifdef_DEBUG #definenewDEBUG_NEW #undefTHIS_FILE staticcharTHIS_FILE[]=__FILE__; #endif ///////////////////////////////////////////////////////////////////////////// //CECGViewerApp BEGIN_MESSAGE_MAP(CECGViewerApp,CWinApp) //{{AFX_MSG_MAP(CECGViewerApp) 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() ///////////////////////////////////////////////////////////////////////////// //CECGViewerAppconstruction CECGViewerApp: : CECGViewerApp() { //TODO: addconstructioncodehere, //PlaceallsignificantinitializationinInitInstance } ///////////////////////////////////////////////////////////////////////////// //TheoneandonlyCECGViewerAppobject CECGViewerApptheApp; ///////////////////////////////////////////////////////////////////////////// //CECGViewerAppinitialization BOOLCECGViewerApp: : InitInstance() { AfxEnableControlContainer(); //Standardinitialization //Ifyouarenotusingthesefeaturesandwishtoreducethesize //ofyourfinalexecutable,youshouldremovefromthefollowing //thespecificinitializationroutinesyoudonotneed. #ifdef_AFXDLL Enable3dControls();//CallthiswhenusingMFCinasharedDLL #else Enable3dControlsStatic();//CallthiswhenlinkingtoMFCstatically #endif //Changetheregistrykeyunderwhichoursettingsarestored. //TODO: Youshouldmodifythisstringtobesomethingappropriate //suchasthenameofyourcompanyororganization. SetRegistryKey(_T("LocalAppWizard-GeneratedApplications")); LoadStdProfileSettings();//LoadstandardINIfileoptions(includingMRU) //Registertheapplication'sdocumenttemplates.Documenttemplates //serveastheconnectionbetweendocuments,framewindowsandviews. CMultiDocTemplate*pDocTemplate; pDocTemplate=newCMultiDocTemplate( IDR_ECGVIETYPE, RUNTIME_CLASS(CECGViewerDoc), RUNTIME_CLASS(CChildFrame),//customMDIchildframe RUNTIME_CLASS(CECGViewerView)); AddDocTemplate(pDocTemplate); //createmainMDIFramewindow CMainFrame*pMainFrame=newCMainFrame; if(! pMainFrame->LoadFrame(IDR_MAINFRAME)) returnFALSE; m_pMainWnd=pMainFrame; //Parsecommandlineforstandardshellcommands,DDE,fileopen CCommandLineInfocmdInfo; ParseCommandLine(cmdInfo); cmdInfo.m_nShellCommand=CCommandLineInfo: : FileNothing; //Dispatchcommandsspecifiedonthecommandline if(! ProcessShellCommand(cmdInfo)) returnFALSE; //Themainwindowhasbeeninitialized,soshowandupdateit. pMainFrame->ShowWindow(m_nCmdShow); pMainFrame->UpdateWindow(); returnTRUE; } ///////////////////////////////////////////////////////////////////////////// //CAboutDlgdialogusedforAppAbout classCAboutDlg: publicCDialog { public: CAboutDlg(); //DialogData //{{AFX_DATA(CAboutDlg) enum{IDD
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- mfcECGViewer