📄 dialogsourcechoice.cpp
字号:
// DialogSourceChoice.cpp : implementation file
//
#include "stdafx.h"
#include "图像特征跟踪系统.h"
#include "DialogSourceChoice.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CDialogSourceChoice property page
IMPLEMENT_DYNCREATE(CDialogSourceChoice, CPropertyPage)
CDialogSourceChoice::CDialogSourceChoice() : CPropertyPage(CDialogSourceChoice::IDD)
{
//{{AFX_DATA_INIT(CDialogSourceChoice)
m_nInputFileNumber = 9000;
m_strInputFilePath = _T("e:\\");
m_nUSBCameraORHardDiskFile = 2;
//}}AFX_DATA_INIT
m_conTrackSourceType = TST_HARDDISK_FILE;
}
CDialogSourceChoice::~CDialogSourceChoice()
{
}
void CDialogSourceChoice::DoDataExchange(CDataExchange* pDX)
{
CPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CDialogSourceChoice)
DDX_Text(pDX, IDC_EDIT_INPUTFILE_NUMBER, m_nInputFileNumber);
DDV_MinMaxInt(pDX, m_nInputFileNumber, 1, 2147483647);
DDX_Text(pDX, IDC_EDIT_INPUTFILE_PATH, m_strInputFilePath);
DDX_Radio(pDX, IDC_RADIO_USB_CAMERA, m_nUSBCameraORHardDiskFile);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CDialogSourceChoice, CPropertyPage)
//{{AFX_MSG_MAP(CDialogSourceChoice)
ON_BN_CLICKED(IDC_RADIO_HARDDISK, OnRadioHarddisk)
ON_BN_CLICKED(IDC_RADIO_USB_CAMERA, OnRadioUsbCamera)
ON_BN_CLICKED(IDC_BUTTON_BROWSE_FILEPATH, OnButtonBrowseFilepath)
ON_EN_CHANGE(IDC_EDIT_INPUTFILE_NUMBER, OnChangeEditInputfileNumber)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CDialogSourceChoice message handlers
void CDialogSourceChoice::OnButtonBrowseFilepath()
{
static char szFilter[] = "BMP文件(*.bmp)|*.bmp||";
CFileDialog dlg(TRUE,"bmp",NULL,OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,"BMP文件(*.bmp)|*.bmp||");
if(dlg.DoModal() == IDOK)
{
m_strInputFilePath = dlg.GetPathName();
}
this->UpdateData(FALSE);
CButton* pButton=NULL;
pButton = (CButton*) this->GetDlgItem(IDC_RADIO_HARDDISK);
pButton->SetCheck(true);
UpdateWindow();
}
void CDialogSourceChoice::OnRadioHarddisk()
{
if(IsDlgButtonChecked(IDC_RADIO_HARDDISK))
{
m_nUSBCameraORHardDiskFile = 2;
m_conTrackSourceType = TST_HARDDISK_FILE;
UpdateWindow();
CWnd* pWnd = this->GetDlgItem(IDC_EDIT_INPUTFILE_PATH);
pWnd->EnableWindow(true);
pWnd = this->GetDlgItem(IDC_EDIT_INPUTFILE_NUMBER);
pWnd->EnableWindow(true);
pWnd = this->GetDlgItem(IDC_BUTTON_BROWSE_FILEPATH);
pWnd->EnableWindow(true);
this->UpdateData(true);
}
}
void CDialogSourceChoice::OnRadioUsbCamera()
{
if(IsDlgButtonChecked(IDC_RADIO_USB_CAMERA))
{
m_nUSBCameraORHardDiskFile = 1;
m_conTrackSourceType = TST_USB_CAMERA;
UpdateWindow();
CWnd* pWnd = this->GetDlgItem(IDC_EDIT_INPUTFILE_PATH);
pWnd->EnableWindow(false);
pWnd = this->GetDlgItem(IDC_EDIT_INPUTFILE_NUMBER);
pWnd->EnableWindow(false);
pWnd = this->GetDlgItem(IDC_BUTTON_BROWSE_FILEPATH);
pWnd->EnableWindow(false);
this->UpdateData(true);
}
}
BOOL CDialogSourceChoice::OnSetActive()
{
CButton* pButton=NULL;
if(m_nUSBCameraORHardDiskFile==2)
{
pButton = (CButton*) this->GetDlgItem(IDC_RADIO_HARDDISK);
pButton->SetCheck(true);
pButton = (CButton*) this->GetDlgItem(IDC_BUTTON_BROWSE_FILEPATH);
pButton->SetCheck(true);
}
else
{
pButton = (CButton*) this->GetDlgItem(IDC_RADIO_USB_CAMERA);
pButton->SetCheck(true);
}
UpdateWindow();
return CPropertyPage::OnSetActive();
}
void CDialogSourceChoice::OnChangeEditInputfileNumber()
{
this->UpdateData(true);
// send this notification unless you override the CPropertyPage::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -