VISDlg.cpp
资源名称:VIS.zip [点击查看]
上传用户:sdgangtie
上传日期:2020-03-07
资源大小:7324k
文件大小:17k
源码类别:
数值算法/人工智能
开发平台:
Visual C++
- // VISDlg.cpp : implementation file
- //
- #include "stdafx.h"
- #include "VIS.h"
- #include "VISDlg.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #endif
- // CAboutDlg dialog used for App About
- class CAboutDlg : public CDialog
- {
- public:
- CAboutDlg();
- // Dialog Data
- enum { IDD = IDD_ABOUTBOX };
- protected:
- virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
- // Implementation
- protected:
- // Generated message map functions
- //{{AFX_MSG(CAboutDlg)
- virtual BOOL OnInitDialog();
- //}}AFX_MSG
- DECLARE_MESSAGE_MAP()
- private:
- CButtonST m_Logo;
- CButtonST m_Face;
- public:
- afx_msg void OnBnClickedOk();
- };
- CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
- {
- }
- void CAboutDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_LOGO, m_Logo);
- DDX_Control(pDX, IDC_FACE, m_Face);
- }
- BOOL CAboutDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // Logo button
- m_Logo.m_bShowDisabledBitmap = FALSE;
- m_Logo.SetBitmaps(IDB_LOGO, RGB(255, 255, 255));
- // Face button
- m_Face.m_bShowDisabledBitmap = FALSE;
- m_Face.SetBitmaps(IDB_FACE, RGB(0, 255, 0));
- // Write class version
- CString sVersion;
- sVersion.Format(_T("System VIS Version %s"), CButtonST::GetVersionC());
- GetDlgItem(IDC_VERSION)->SetWindowText(sVersion);
- return TRUE;
- } // End of OnInitDialog
- void CAboutDlg::OnBnClickedOk()
- {
- OnOK();
- }
- BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
- ON_BN_CLICKED(IDOK, &CAboutDlg::OnBnClickedOk)
- END_MESSAGE_MAP()
- // CVISDlg dialog
- CVISDlg::CVISDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CVISDlg::IDD, pParent)
- , m_TimeValue(_T(""))
- {
- m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
- }
- void CVISDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- DDX_Control(pDX, IDC_LIST, m_ListBoxCtrl);
- DDX_Control(pDX, IDC_ADD, m_Add);
- DDX_Control(pDX, IDC_DELETE, m_Del);
- DDX_Control(pDX, IDC_MODE, m_Mod);
- DDX_Control(pDX, IDC_SLIDER, m_SliderCtrl);
- DDX_Text(pDX, IDC_TIME, m_TimeValue);
- DDX_Control(pDX, IDC_OPEN, m_Open);
- DDX_Control(pDX, IDC_RUN, m_Run);
- DDX_Control(pDX, IDC_STOP, m_Stop);
- DDX_Control(pDX, IDC_SETTING, m_Setting);
- }
- BEGIN_MESSAGE_MAP(CVISDlg, CDialog)
- ON_WM_SYSCOMMAND()
- ON_WM_PAINT()
- ON_WM_QUERYDRAGICON()
- ON_WM_RBUTTONUP()
- ON_WM_TIMER()
- ON_WM_SIZE()
- //}}AFX_MSG_MAP
- ON_BN_CLICKED(IDC_ADD, &CVISDlg::OnBnClickedAdd)
- ON_BN_CLICKED(IDC_DELETE, &CVISDlg::OnBnClickedDelete)
- ON_COMMAND(ID_RUNSTYLE_NORMALPLAY, &CVISDlg::OnStyleNormal)
- ON_COMMAND(ID_RUNSTYLE_FGTEMPPLAY, &CVISDlg::OnStyleTemped)
- ON_COMMAND(ID_RUNSTYLE_RESULTPLAY, &CVISDlg::OnStyleResult)
- ON_COMMAND(IDM_FILE_OPEN, &CVISDlg::OnBnClickedOpen)
- ON_COMMAND(IDM_FILE_ADD, &CVISDlg::OnBnClickedAdd)
- ON_COMMAND(IDM_RUNSTYLE_NORMALPLAY, &CVISDlg::OnStyleNormal)
- ON_COMMAND(IDM_RUNSTYLE_FGTEMPPLAY, &CVISDlg::OnStyleTemped)
- ON_COMMAND(IDM_RUNSTYLE_RESULTPLAY, &CVISDlg::OnStyleResult)
- ON_COMMAND(ID_RMENU_SETTING, &CVISDlg::OnBnClickedSetting)
- ON_COMMAND(ID_EXIT, &CVISDlg::OnExit)
- ON_BN_CLICKED(IDC_OPEN, &CVISDlg::OnBnClickedOpen)
- ON_BN_CLICKED(IDC_RUN, &CVISDlg::OnBnClickedRun)
- ON_BN_CLICKED(IDC_STOP, &CVISDlg::OnBnClickedStop)
- ON_LBN_DBLCLK(IDC_LIST, &CVISDlg::OnLbnDblclkList)
- ON_LBN_SELCHANGE(IDC_LIST, &CVISDlg::OnLbnSelchangeList)
- ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER, &CVISDlg::OnNMReleasedcaptureSlider)
- ON_BN_CLICKED(IDC_SETTING, &CVISDlg::OnBnClickedSetting)
- END_MESSAGE_MAP()
- // CVISDlg message handlers
- BOOL CVISDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
- // Add "About..." menu item to system menu.
- // IDM_ABOUTBOX must be in the system command range.
- ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
- ASSERT(IDM_ABOUTBOX < 0xF000);
- CMenu* pSysMenu = GetSystemMenu(FALSE);
- if (pSysMenu != 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's main window is not a dialog
- SetIcon(m_hIcon, TRUE); // Set big icon
- SetIcon(m_hIcon, FALSE); // Set small icon
- // TODO: Add extra initialization here
- { // 初始化状态栏
- m_StatusBar = new CStatusBarCtrl;
- RECT m_Rect;
- GetClientRect(&m_Rect);
- m_Rect.top = m_Rect.bottom - 20;
- m_StatusBar->Create(WS_VISIBLE|CBRS_BOTTOM,m_Rect,this,3);
- int nParts[2] = {100,-1};
- m_StatusBar->SetParts(2,nParts);
- m_StatusBar->SetText(TEXT(" Ready"),0,0);
- m_StatusBar->SetText(TEXT(" "),1,0);
- }
- { // 初始化按钮
- short shBtnColor = 0;
- m_Add.SetIcon(IDI_ICON_ADD, (int)BTNST_AUTO_GRAY);
- m_Add.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
- m_Add.SetTooltipText(_T("Add File"));
- m_Del.SetIcon(IDI_ICON_DEL, (int)BTNST_AUTO_GRAY);
- m_Del.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
- m_Del.SetTooltipText(_T("Delete File"));
- m_Mod.SetIcon(IDI_ICON_MOD, (int)BTNST_AUTO_GRAY);
- m_Mod.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
- m_Mod.SetTooltipText(_T("Play Mode"));
- m_Mod.SetMenu(IDR_MENU, m_hWnd);
- shBtnColor = 30;
- m_Setting.SetIcon(IDI_ICON_SET, (int)BTNST_AUTO_GRAY);
- m_Setting.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
- m_Setting.SetTooltipText(_T("Setting Paramters"));
- // m_Open.SetIcon(IDI_ICON_OPEN2, IDI_ICON_OPEN1);
- // m_Open.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
- //
- // m_Run.SetIcon(IDI_ICON_PLAY2, IDI_ICON_PLAY1);
- // m_Run.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
- //
- // m_Stop.SetIcon(IDI_ICON_STOP, IDI_ICON_STOP);
- // m_Stop.OffsetColor(CButtonST::BTNST_COLOR_BK_IN, shBtnColor);
- }
- VERIFY(menu.LoadMenu(IDR_MENU_MAIN));
- m_FilePathList.RemoveAll();
- m_FilePathIndex = 0;
- m_RunStyle = 0;
- m_SliderCtrl.SetRange(0,100,TRUE);
- m_pImage = cvLoadImage("default.bmp");
- SetTimer(1,33,NULL);
- return TRUE; // return TRUE unless you set the focus to a control
- }
- void CVISDlg::OnSysCommand(UINT nID, LPARAM lParam)
- {
- if ((nID & 0xFFF0) == 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 CVISDlg::OnPaint()
- {
- if (IsIconic())
- {
- CPaintDC dc(this); // device context for painting
- SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
- // Center icon in client rectangle
- int cxIcon = GetSystemMetrics(SM_CXICON);
- int cyIcon = GetSystemMetrics(SM_CYICON);
- CRect rect;
- GetClientRect(&rect);
- int x = (rect.Width() - cxIcon + 1) / 2;
- int y = (rect.Height() - cyIcon + 1) / 2;
- // Draw the icon
- dc.DrawIcon(x, y, m_hIcon);
- }
- else
- {
- CDialog::OnPaint();
- }
- }
- // The system calls this function to obtain the cursor to display while the user drags
- // the minimized window.
- HCURSOR CVISDlg::OnQueryDragIcon()
- {
- return static_cast<HCURSOR>(m_hIcon);
- }
- void CVISDlg::OnBnClickedAdd()
- {
- CString Filter = TEXT("视频文件(*.avi)|*avi|所有文件(*.*)|*.*||");
- CFileDialog Dlg(TRUE,NULL,NULL,OFN_ALLOWMULTISELECT|OFN_ENABLESIZING,Filter,this);
- if(Dlg.DoModal()==IDOK)
- {
- POSITION Pos = Dlg.GetStartPosition();
- while (Pos)
- {
- CString next = Dlg.GetNextPathName(Pos);
- if(!m_FilePathList.Find(next))
- {
- CString filename = next.Right(next.GetLength()-next.ReverseFind('\')-1);
- m_ListBoxCtrl.InsertString(m_FilePathIndex++,filename);
- m_FilePathList.AddTail(next);
- }
- }
- }
- }
- void CVISDlg::OnBnClickedDelete()
- {
- for (int i = m_ListBoxCtrl.GetCount()-1; i >= 0; i--)
- {
- if (m_ListBoxCtrl.GetSel(i))
- {
- if (m_FilePath == m_FilePathList.GetAt(m_FilePathList.FindIndex(i)))
- {
- m_pRunTrack.Stop();
- }
- m_FilePathList.RemoveAt(m_FilePathList.FindIndex(i));
- m_ListBoxCtrl.DeleteString(i);
- m_FilePathIndex--;
- }
- }
- }
- void CVISDlg::OnStyleNormal()
- {
- m_Mod.m_menuPopup.GetSubMenu(0)->CheckMenuItem(ID_RUNSTYLE_NORMALPLAY,MF_BYCOMMAND|MF_CHECKED);
- m_Mod.m_menuPopup.GetSubMenu(0)->CheckMenuItem(ID_RUNSTYLE_FGTEMPPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- m_Mod.m_menuPopup.GetSubMenu(0)->CheckMenuItem(ID_RUNSTYLE_RESULTPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- menu.GetSubMenu(0)->CheckMenuItem(IDM_RUNSTYLE_NORMALPLAY,MF_BYCOMMAND|MF_CHECKED);
- menu.GetSubMenu(0)->CheckMenuItem(IDM_RUNSTYLE_FGTEMPPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- menu.GetSubMenu(0)->CheckMenuItem(IDM_RUNSTYLE_RESULTPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- m_RunStyle = 0;
- m_Add.SetTooltipText(_T("Add File"));
- }
- void CVISDlg::OnStyleTemped()
- {
- m_Mod.m_menuPopup.GetSubMenu(0)->CheckMenuItem(ID_RUNSTYLE_NORMALPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- m_Mod.m_menuPopup.GetSubMenu(0)->CheckMenuItem(ID_RUNSTYLE_FGTEMPPLAY,MF_BYCOMMAND|MF_CHECKED);
- m_Mod.m_menuPopup.GetSubMenu(0)->CheckMenuItem(ID_RUNSTYLE_RESULTPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- menu.GetSubMenu(0)->CheckMenuItem(IDM_RUNSTYLE_NORMALPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- menu.GetSubMenu(0)->CheckMenuItem(IDM_RUNSTYLE_FGTEMPPLAY,MF_BYCOMMAND|MF_CHECKED);
- menu.GetSubMenu(0)->CheckMenuItem(IDM_RUNSTYLE_RESULTPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- m_RunStyle = 1;
- m_Del.SetTooltipText(_T("Delete File"));
- }
- void CVISDlg::OnStyleResult()
- {
- m_Mod.m_menuPopup.GetSubMenu(0)->CheckMenuItem(ID_RUNSTYLE_NORMALPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- m_Mod.m_menuPopup.GetSubMenu(0)->CheckMenuItem(ID_RUNSTYLE_FGTEMPPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- m_Mod.m_menuPopup.GetSubMenu(0)->CheckMenuItem(ID_RUNSTYLE_RESULTPLAY,MF_BYCOMMAND|MF_CHECKED);
- menu.GetSubMenu(0)->CheckMenuItem(IDM_RUNSTYLE_NORMALPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- menu.GetSubMenu(0)->CheckMenuItem(IDM_RUNSTYLE_FGTEMPPLAY,MF_BYCOMMAND|MF_UNCHECKED);
- menu.GetSubMenu(0)->CheckMenuItem(IDM_RUNSTYLE_RESULTPLAY,MF_BYCOMMAND|MF_CHECKED);
- m_RunStyle = 2;
- m_Mod.SetTooltipText(_T("Play Mode"));
- }
- void CVISDlg::OnBnClickedOpen()
- {
- int index = m_ListBoxCtrl.GetCurSel();
- CString Filter = TEXT("视频文件(*.avi)|*avi|所有文件(*.*)|*.*||");
- CFileDialog Dlg(TRUE,NULL,NULL,NULL,Filter,this);
- if(Dlg.DoModal()==IDOK)
- {
- CString path = Dlg.GetPathName();
- if(!m_FilePathList.Find(path))
- {
- CString filename = path.Right(path.GetLength()-path.ReverseFind('\')-1);
- m_ListBoxCtrl.InsertString(m_FilePathIndex++,filename);
- m_FilePathList.AddTail(path);
- }
- CString filename = path.Right(path.GetLength()-path.ReverseFind('\')-1);
- index = m_ListBoxCtrl.FindString(-1,filename);
- for (int i = 0; i < m_ListBoxCtrl.GetCount(); i++)
- {
- if (i == index)
- {
- m_ListBoxCtrl.SetSel(i,TRUE);
- }
- else
- m_ListBoxCtrl.SetSel(i,FALSE);
- }
- RedrawWindow();
- m_FilePath = path;
- USES_CONVERSION;
- char *str = T2A(m_FilePath);
- GetParamFromDlg();
- m_SliderCtrl.SetRange(0,(int)m_pRunTrack.Init(str,m_RunStyle,m_ParamSetDlg));
- m_SliderCtrl.EnableWindow(TRUE);
- m_pRunTrack.Run();
- GetDlgItem(IDC_RUN)->SetWindowText(TEXT("Pause"));
- }
- m_ListBoxCtrl.SetCurSel(index);
- }
- void CVISDlg::OnBnClickedRun()
- {
- if (m_FilePath.IsEmpty())
- return;
- int state = m_pRunTrack.GetState();
- if (state==0)
- {
- int index;
- if ((index = m_ListBoxCtrl.GetCurSel()) >= 0)
- {
- if (m_pRunTrack.GetState() == 0)
- {
- m_FilePath = m_FilePathList.GetAt(m_FilePathList.FindIndex(index));
- }
- }
- USES_CONVERSION;
- char *str = T2A(m_FilePath);
- GetParamFromDlg();
- m_SliderCtrl.SetRange(0,(int)m_pRunTrack.Init(str,m_RunStyle,m_ParamSetDlg));
- m_SliderCtrl.EnableWindow(TRUE);
- m_pRunTrack.Run();
- GetDlgItem(IDC_RUN)->SetWindowText(TEXT("Pause"));
- }
- if (state==1)
- {
- m_pRunTrack.Pause();
- GetDlgItem(IDC_RUN)->SetWindowText(TEXT("Continue"));
- m_StatusBar->SetText(TEXT(" Ready"),0,0);
- }
- if (state==2)
- {
- m_pRunTrack.Run();
- GetDlgItem(IDC_RUN)->SetWindowText(TEXT("Pause"));
- }
- }
- void CVISDlg::OnBnClickedStop()
- {
- m_pRunTrack.Stop();
- m_SliderCtrl.SetPos(m_pRunTrack.GetFrameCount());
- GetDlgItem(IDC_RUN)->SetWindowText(TEXT("Run"));
- m_StatusBar->SetText(TEXT(" Ready"),0,0);
- GetDlgItem(IDC_TIME)->SetWindowText(m_pRunTrack.GetTimeFre());
- }
- void CVISDlg::OnBnClickedSetting()
- {
- if (m_ParamDlg.DoModal());
- }
- void CVISDlg::OnExit()
- {
- CDialog::OnCancel();
- }
- void CVISDlg::OnLbnDblclkList()
- {
- int index;
- if ((index = m_ListBoxCtrl.GetCurSel()) >= 0)
- {
- for (int i = 0; i < m_ListBoxCtrl.GetCount(); i++)
- {
- if (i == index)
- {
- m_ListBoxCtrl.SetSel(i,TRUE);
- }
- else
- m_ListBoxCtrl.SetSel(i,FALSE);
- }
- RedrawWindow();
- m_FilePath = m_FilePathList.GetAt(m_FilePathList.FindIndex(index));
- USES_CONVERSION;
- char *str = T2A(m_FilePath);
- GetParamFromDlg();
- m_SliderCtrl.SetRange(0,(int)m_pRunTrack.Init(str,m_RunStyle,m_ParamSetDlg));
- m_SliderCtrl.EnableWindow(TRUE);
- m_pRunTrack.Run();
- GetDlgItem(IDC_RUN)->SetWindowText(TEXT("Pause"));
- }
- }
- void CVISDlg::OnLbnSelchangeList()
- {
- int index;
- if ((index = m_ListBoxCtrl.GetCurSel()) >= 0)
- {
- if (m_pRunTrack.GetState() == 0)
- {
- m_FilePath = m_FilePathList.GetAt(m_FilePathList.FindIndex(index));
- }
- }
- }
- void CVISDlg::OnRButtonUp(UINT nFlags, CPoint point)
- {
- DWORD dwPos = GetMessagePos();
- CPoint _point(LOWORD(dwPos), HIWORD(dwPos));
- CMenu* popup = menu.GetSubMenu(0);
- ASSERT( popup != NULL );
- popup->TrackPopupMenu(TPM_LEFTALIGN|TPM_RIGHTBUTTON, _point.x, _point.y, this);
- CDialog::OnRButtonUp(nFlags, point);
- }
- void CVISDlg::OnNMReleasedcaptureSlider(NMHDR *pNMHDR, LRESULT *pResult)
- {
- if (m_pRunTrack.GetState() == 2)
- {
- m_pRunTrack.SetPosition(m_SliderCtrl.GetPos());
- m_pRunTrack.Run();
- GetDlgItem(IDC_RUN)->SetWindowText(TEXT("Pause"));
- }
- }
- void CVISDlg::GetParamFromDlg()
- {
- m_ParamSetDlg.m_FG = m_ParamDlg.m_FG;
- m_ParamSetDlg.m_BT = m_ParamDlg.m_BT;
- m_ParamSetDlg.m_BPP = m_ParamDlg.m_BPP;
- m_ParamSetDlg.m_BTA = m_ParamDlg.m_BTA;
- m_ParamSetDlg.m_Threshold = m_ParamDlg.m_Threshold;
- m_ParamSetDlg.m_WMin = m_ParamDlg.m_WMin;
- m_ParamSetDlg.m_WMax = m_ParamDlg.m_WMax;
- m_ParamSetDlg.m_HMin = m_ParamDlg.m_HMin;
- m_ParamSetDlg.m_HMax = m_ParamDlg.m_HMax;
- m_ParamSetDlg.m_Check = m_ParamDlg.m_Check;
- // CString str;
- // str.Format(TEXT("%d,%d,%d,%d"),m_ParamSetDlg.m_FG,m_ParamSetDlg.m_BT,m_ParamSetDlg.m_BPP,m_ParamSetDlg.m_BTA);
- // MessageBox(str);
- }
- void CVISDlg::DrawFrameToHDC(IplImage* pImage, UINT ID)
- {
- if (pImage != NULL)
- {
- CDC *pDC = GetDlgItem(ID)->GetDC();
- HDC hDC = pDC->GetSafeHdc();
- CRect r;
- GetDlgItem(ID)->GetClientRect(&r);
- CvvImage img;
- img.CopyOf(pImage);
- img.DrawToHDC(hDC, &r);
- ReleaseDC(pDC);
- }
- }
- void CVISDlg::OnTimer(UINT_PTR nIDEvent)
- {
- static int Tn = 0;
- if (nIDEvent == 1)
- {
- int state = m_pRunTrack.GetState();
- if(state == 0)
- {
- DrawFrameToHDC(m_pImage, IDC_VIDEO);
- GetDlgItem(IDC_TIME)->SetWindowText(TEXT(""));
- m_StatusBar->SetText(TEXT(" Ready"),0,0);
- GetDlgItem(IDC_RUN)->SetWindowText(TEXT("Run"));
- m_SliderCtrl.SetPos(m_pRunTrack.GetFrameCount());
- m_SliderCtrl.EnableWindow(FALSE);
- }
- if(state == 1){
- IplImage* pImage = m_pRunTrack.GetNextFrame();
- if(pImage)
- {
- DrawFrameToHDC(pImage, IDC_VIDEO);
- m_SliderCtrl.SetPos(m_pRunTrack.GetFrameCount());
- if (Tn%40 == 0)
- m_StatusBar->SetText(TEXT(" Busy"),0,0);
- if (Tn%40 == 10)
- m_StatusBar->SetText(TEXT(" Busy."),0,0);
- if (Tn%40 == 20)
- m_StatusBar->SetText(TEXT(" Busy.."),0,0);
- if (Tn%40 == 30)
- m_StatusBar->SetText(TEXT(" Busy..."),0,0);
- Tn++;
- GetDlgItem(IDC_TIME)->SetWindowText(m_pRunTrack.GetTimeFre());
- }
- }
- }
- CDialog::OnTimer(nIDEvent);
- }
- void CVISDlg::OnSize(UINT nType, int cx, int cy)
- {
- CDialog::OnSize(nType, cx, cy);
- if (!IsWindowVisible())
- return ;
- CRect window;
- GetWindowRect( &window );
- int width = window.right - window.left - 8;
- int height = window.bottom - window.top - 36;
- if(width<480) width = 480;
- if(height<360) height = 360;
- CWnd* pNextWnd = this->GetTopWindow();
- pNextWnd->MoveWindow(window.left,window.top,width,height);
- for(int i = 1; pNextWnd != NULL; i++ )
- {
- int ID = pNextWnd->GetDlgCtrlID();
- if (ID == IDC_VIDEO) pNextWnd->MoveWindow( 12, 12, width - 195, height - 145, 1 );
- if (ID == IDC_LIST) pNextWnd->MoveWindow( width - 183, 12, 171, height - 145, 1 );
- if (ID == IDC_ADD) pNextWnd->MoveWindow( width - 183, height - 133, 57, 25, 1 );
- if (ID == IDC_DELETE) pNextWnd->MoveWindow( width - 126, height - 133, 57, 25, 1 );
- if (ID == IDC_MODE) pNextWnd->MoveWindow( width - 69, height - 133, 57, 25, 1 );
- if (ID == IDC_SLIDER) pNextWnd->MoveWindow( 12, height - 130, width- 190, 25, 1 );
- if (ID == IDC_TIME) pNextWnd->MoveWindow( 25, height - 64, 64, 26, 1 );
- if (ID == IDC_OPEN) pNextWnd->MoveWindow( 125, height - 70, 64, 26, 1 );
- if (ID == IDC_RUN) pNextWnd->MoveWindow( 232, height - 70, 64, 26, 1 );
- if (ID == IDC_STOP) pNextWnd->MoveWindow( 339, height - 70, 64, 26, 1 );
- if (ID == IDC_SETTING) pNextWnd->MoveWindow( 450, height - 75, 96, 36, 1 );
- m_StatusBar->MoveWindow(0, height - 12, width, 20, 1);
- pNextWnd = pNextWnd->GetNextWindow();
- }
- }