// FeederPaper.cpp: 实现文件 // #include "stdafx.h" #include "FeederPaper.h" #include "afxdialogex.h" #include "Resource.h" //#include "UI_INI.h" // FeederPaper 对话框 //extern CUI_INI* m_pUI_INI; IMPLEMENT_DYNAMIC(FeederPaper, CDialog) FeederPaper::FeederPaper(CWnd* pParent /*=nullptr*/) : CDialog(IDD_DIALOG_PAGEFEEDPAPER, pParent) { } FeederPaper::~FeederPaper() { } void FeederPaper::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); DDX_Control(pDX, IDC_CMBORENTATION, m_cmBoxOrentation); DDX_Control(pDX, IDC_SLDDETECTLEVEL, m_sldSkrewDetecttion); } BEGIN_MESSAGE_MAP(FeederPaper, CDialog) ON_BN_CLICKED(IDC_RDCONSISTSCAN, &FeederPaper::OnBnClickedRdconsistscan) ON_BN_CLICKED(IDC_RDSPECIFYSCANNUM, &FeederPaper::OnBnClickedRdspecifyscannum) ON_BN_CLICKED(IDC_CKSKEWDETECT, &FeederPaper::OnBnClickedCkskewdetect) END_MESSAGE_MAP() // FeederPaper 消息处理程序 BOOL FeederPaper::OnInitDialog() { CDialog::OnInitDialog(); OnInitcmBoxOrentation(0); OnInitsldSkrewDetection(3); // TODO: 在此添加额外的初始化 #ifndef G200 GetDlgItem(IDC_CKBINDINGDETECT)->ShowWindow(FALSE); GetDlgItem(IDC_CKSKEWDETECT)->ShowWindow(FALSE); GetDlgItem(IDC_LBSDL)->ShowWindow(FALSE); GetDlgItem(IDC_SLDDETECTLEVEL)->ShowWindow(FALSE); GetDlgItem(IDC_LBSDR)->ShowWindow(FALSE); #endif // !G200 return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE } void FeederPaper::OnInitcmBoxOrentation(int selectIndex) { m_cmBoxOrentation.InsertString(0, _T("0°")); m_cmBoxOrentation.InsertString(1, _T("90°")); m_cmBoxOrentation.InsertString(2, _T("180°")); m_cmBoxOrentation.InsertString(3, _T("-90°")); //m_cmBoxOrentation.InsertString(4, _T("自动文本方向识别°")); m_cmBoxOrentation.SetCurSel(selectIndex); } void FeederPaper::OnInitsldSkrewDetection(int value) { m_sldSkrewDetecttion.SetRange(1, 5); m_sldSkrewDetecttion.SetTicFreq(1); m_sldSkrewDetecttion.SetPos(value); } bool FeederPaper::getDoubleFeeder() { //((CButton *)GetDlgItem(GetDlgItem(IDC_CKULTRSONICDETECT,m_hWnd)); int nCheck = 0; nCheck=((CButton *)GetDlgItem(IDC_CKULTRSONICDETECT))->GetCheck(); return nCheck==1; } bool FeederPaper::getBindingDetectable() { int nCheck = 0; nCheck = ((CButton *)GetDlgItem(IDC_CKBINDINGDETECT))->GetCheck(); return nCheck == 1; } bool FeederPaper::getBackFlip180() { int nCheck = 0; nCheck = ((CButton *)GetDlgItem(IDC_CKBACKROTATION))->GetCheck(); return nCheck == 1; } bool FeederPaper::getSkrewDetect() { int nCheck = 0; nCheck = ((CButton *)GetDlgItem(IDC_CKSKEWDETECT))->GetCheck(); return nCheck == 1; } int FeederPaper::getSkrewDetectLevel() { return (((CSliderCtrl*)GetDlgItem(IDC_SLDDETECTLEVEL))->GetPos());; } int FeederPaper::getOrentation() { return (((CComboBox*)GetDlgItem(IDC_CMBORENTATION))->GetCurSel());; } int FeederPaper::getScanCount() { return 0; } void FeederPaper::OnBnClickedRdconsistscan() { // TODO: 在此添加控件通知处理程序代码 BOOL cheked=(((CButton*)GetDlgItem(IDC_RDCONSISTSCAN))->GetCheck());; ((CEdit*)GetDlgItem(IDC_EDSCANNUM))->EnableWindow(cheked?FALSE:TRUE); } void FeederPaper::OnBnClickedRdspecifyscannum() { // TODO: 在此添加控件通知处理程序代码 BOOL cheked=(((CButton*)GetDlgItem(IDC_RDSPECIFYSCANNUM))->GetCheck());; ((CEdit*)GetDlgItem(IDC_EDSCANNUM))->EnableWindow(cheked?TRUE:FALSE); } void FeederPaper::OnBnClickedCkskewdetect() { // TODO: 在此添加控件通知处理程序代码 int nCheck = ((CButton *)GetDlgItem(IDC_CKSKEWDETECT))->GetCheck(); ((CStatic*)GetDlgItem(IDC_LBSDL))->EnableWindow(nCheck==1?TRUE:FALSE); ((CStatic*)GetDlgItem(IDC_LBSDR))->EnableWindow(nCheck==1?TRUE:FALSE); if (nCheck!=1) { ((CSliderCtrl*)GetDlgItem(IDC_SLDDETECTLEVEL))->SetPos(3); } ((CSliderCtrl*)GetDlgItem(IDC_SLDDETECTLEVEL))->EnableWindow(nCheck==1?TRUE:FALSE); } BOOL FeederPaper::PreTranslateMessage(MSG* pMsg) { // TODO: 在此添加专用代码和/或调用基类 if (pMsg->message==WM_CHAR) { CEdit* pEdit = (CEdit*)GetDlgItem(IDC_EDSCANNUM); if(pMsg->hwnd == pEdit->m_hWnd) { CString strText; pEdit->GetWindowText(strText); if((pMsg->wParam>='0'&&pMsg->wParam<='9'||pMsg->wParam=='\b')) return CDialog::PreTranslateMessage(pMsg); else return true; } } return CDialog::PreTranslateMessage(pMsg); }