// BatchDis.cpp : Defines the class behaviors for the application. //#include "stdafx.h" #include "BatchDis.h" #include "BatchDisDlg.h" #pragma comment(lib,"SkinPPWTL.lib"); #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] &#61; __FILE__; #endif/ // CBatchDisAppBEGIN_MESSAGE_MAP(CBatchDisApp, CWinApp)//{{AFX_MSG_MAP(CBatchDisApp)// NOTE - the ClassWizard will add and remove mapping macros here.// DO NOT EDIT what you see in these blocks of generated code!//}}AFX_MSGON_COMMAND(ID_HELP, CWinApp::OnHelp) END_MESSAGE_MAP()/ // CBatchDisApp constructionCBatchDisApp::CBatchDisApp() {// TODO: add construction code here,// Place all significant initialization in InitInstance }/ // The one and only CBatchDisApp objectCBatchDisApp theApp;/ // CBatchDisApp initializationBOOL CBatchDisApp::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.skinppLoadSkin(_T("Devoir.ssk")); #ifdef _AFXDLLEnable3dControls(); // Call this when using MFC in a shared DLL #elseEnable3dControlsStatic(); // Call this when linking to MFC statically #endifCBatchDisDlg dlg;m_pMainWnd &#61; &dlg;int nResponse &#61; dlg.DoModal();if (nResponse &#61;&#61; IDOK){// TODO: Place code here to handle when the dialog is// dismissed with OK}else if (nResponse &#61;&#61; IDCANCEL){// TODO: Place code here to handle when the dialog is// dismissed with Cancel}// Since the dialog has been closed, return FALSE so that we exit the// application, rather than start the application&#39;s message pump.return FALSE; }int CBatchDisApp::ExitInstance() {// TODO: Add your specialized code here and/or call the base classskinppExitSkin();return CWinApp::ExitInstance(); }// BatchDisDlg.cpp : implementation file //#include "stdafx.h" #include "BatchDis.h" #include "BatchDisDlg.h"#ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] &#61; __FILE__; #endif/ // CAboutDlg dialog used for App Aboutclass CAboutDlg : public CDialog { public:CAboutDlg();// Dialog Data//{{AFX_DATA(CAboutDlg)enum { IDD &#61; IDD_ABOUTBOX };//}}AFX_DATA// ClassWizard generated virtual function overrides//{{AFX_VIRTUAL(CAboutDlg)protected:virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support//}}AFX_VIRTUAL// Implementation protected://{{AFX_MSG(CAboutDlg)//}}AFX_MSGDECLARE_MESSAGE_MAP() };CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) {//{{AFX_DATA_INIT(CAboutDlg)//}}AFX_DATA_INIT }void CAboutDlg::DoDataExchange(CDataExchange* pDX) {CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CAboutDlg)//}}AFX_DATA_MAP }BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)//{{AFX_MSG_MAP(CAboutDlg)// No message handlers//}}AFX_MSG_MAP END_MESSAGE_MAP()/ // CBatchDisDlg dialogCBatchDisDlg::CBatchDisDlg(CWnd* pParent /*&#61;NULL*/): CDialog(CBatchDisDlg::IDD, pParent) {//{{AFX_DATA_INIT(CBatchDisDlg)// NOTE: the ClassWizard will add member initialization here//}}AFX_DATA_INIT// Note that LoadIcon does not require a subsequent DestroyIcon in Win32m_hIcon &#61; AfxGetApp()->LoadIcon(IDR_MAINFRAME);}void CBatchDisDlg::DoDataExchange(CDataExchange* pDX) {CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CBatchDisDlg)// NOTE: the ClassWizard will add DDX and DDV calls here//}}AFX_DATA_MAP }BEGIN_MESSAGE_MAP(CBatchDisDlg, CDialog)//{{AFX_MSG_MAP(CBatchDisDlg)ON_WM_SYSCOMMAND()ON_WM_PAINT()ON_WM_QUERYDRAGICON()ON_BN_CLICKED(IDC_ADD_DATA, OnAddData)ON_BN_CLICKED(IDC_DATA_SHOW, OnDataShow)ON_WM_MOUSEMOVE()//}}AFX_MSG_MAP END_MESSAGE_MAP()/ // CBatchDisDlg message handlersBOOL CBatchDisDlg::OnInitDialog() {CDialog::OnInitDialog();// Add "About..." menu item to system menu.// IDM_ABOUTBOX must be in the system command range.ASSERT((IDM_ABOUTBOX & 0xFFF0) &#61;&#61; IDM_ABOUTBOX);ASSERT(IDM_ABOUTBOX <0xF000);CMenu* pSysMenu &#61; GetSystemMenu(FALSE);if (pSysMenu !&#61; NULL){CString strAboutMenu;strAboutMenu.LoadString(IDS_ABOUTBOX);if (!strAboutMenu.IsEmpty()){pSysMenu->AppendMenu(MF_SEPARATOR);pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);}}// Set the icon for this dialog. The framework does this automatically// when the application&#39;s main window is not a dialogSetIcon(m_hIcon, TRUE); // Set big iconSetIcon(m_hIcon, FALSE);// Set small iconthis->SetWindowText(_T("主对话框"));GetDlgItem(IDC_DATA_SHOW)->EnableWindow(FALSE);// TODO: Add extra initialization hereCShowDlg dlgshow;dlgshow.DoModal();return TRUE; // return TRUE unless you set the focus to a control }void CBatchDisDlg::OnSysCommand(UINT nID, LPARAM lParam) {if ((nID & 0xFFF0) &#61;&#61; IDM_ABOUTBOX){CAboutDlg dlgAbout;dlgAbout.DoModal();}else{CDialog::OnSysCommand(nID, lParam);} }// If you add a minimize button to your dialog, you will need the code below // to draw the icon. For MFC applications using the document/view model, // this is automatically done for you by the framework.void CBatchDisDlg::OnPaint() {if (IsIconic()){CPaintDC dc(this); // device context for paintingSendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);// Center icon in client rectangleint cxIcon &#61; GetSystemMetrics(SM_CXICON);int cyIcon &#61; GetSystemMetrics(SM_CYICON);CRect rect;GetClientRect(&rect);int x &#61; (rect.Width() - cxIcon &#43; 1) / 2;int y &#61; (rect.Height() - cyIcon &#43; 1) / 2;// Draw the icondc.DrawIcon(x, y, m_hIcon);}else{CDialog::OnPaint();} }// The system calls this to obtain the cursor to display while the user drags // the minimized window. HCURSOR CBatchDisDlg::OnQueryDragIcon() {return (HCURSOR) m_hIcon; }void CBatchDisDlg::OnAddData() {// TODO: Add your control notification handler code hereif(dlg.DoModal() &#61;&#61; IDOK){GetDlgItem(IDC_DATA_SHOW)->EnableWindow(TRUE);} } void CBatchDisDlg::OnDataShow() {// TODO: Add your control notification handler code hereCClientDC dc(this);//dc.Ellipse(CRect(100,100,200,200));//划y拱形线dc.MoveTo(65,55);dc.LineTo(70,50);dc.LineTo(75,55);//划xy轴dc.MoveTo(70,50);dc.LineTo(70,420);dc.LineTo(800,420);//画x拱形线dc.MoveTo(795,415);dc.LineTo(800,420);dc.LineTo(795,425);//画机器标线dc.MoveTo(70,330);dc.LineTo(76,330);dc.MoveTo(70,240);dc.LineTo(76,240);dc.MoveTo(70,150);dc.LineTo(76,150);//画机器坐标并且画出M0-7机器int zone&#61; (420-50)/dlg.m_macCount;int halfzone&#61;zone/2;UINT i;for(i&#61;0;i&#61;mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).childFinishTime){have&#61;true;break;}}if(have){CRect rect&#61;CRect(time[minRange]&#43;70,420-halfzone-minRange*zone-10,time[minRange]\&#43;70&#43;mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_usedtime*2,\420-halfzone-minRange*zone&#43;10);dc.FillRect(rect,&brush);dc.TextOut(time[minRange]&#43;70,420-halfzone-minRange*zone&#43;10,\mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_name);time[minRange]&#43;&#61;mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_usedtime*2;if(mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_parent !&#61; NULL){if(mylist[minRange].GetAt(mylist[minRange].FindIndex(i)).m_parent->childFinishTime