📄 expose.cpp
字号:
// expose.cpp : implementation file
//
#include "stdafx.h"
#include "DooDads.h"
#include "expose.h"
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CExposureDialog dialog
CExposureDialog::CExposureDialog(CWnd* pParent /*=NULL*/)
: CDialog(CExposureDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CExposureDialog)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_nShutter = 0;
m_nAperture = 0;
}
void CExposureDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CExposureDialog)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
CSliderCtrl* pAperture = (CSliderCtrl*) GetDlgItem(IDC_APERTURE);
CSliderCtrl* pShutter = (CSliderCtrl*) GetDlgItem(IDC_SHUTTER);
if (pDX->m_bSaveAndValidate)
{
m_nShutter = pShutter->GetPos();
m_nAperture = pShutter->GetPos();
}
else
{
pShutter->SetPos(m_nShutter);
pShutter->SetPos(m_nAperture);
}
}
BEGIN_MESSAGE_MAP(CExposureDialog, CDialog)
//{{AFX_MSG_MAP(CExposureDialog)
ON_WM_HSCROLL()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CExposureDialog message handlers
LPCTSTR pstrAperture[] = {
_T("1.8"),
_T("2.8"),
_T("3.5"),
_T("4"),
_T("5.8"),
_T("8"),
_T("11"),
_T("16"),
_T("22"),
};
LPCTSTR pstrShutter[] = {
_T("1/2000"),
_T("1/1000"),
_T("1/500"),
_T("1/250"),
_T("1/125"),
_T("1/60"),
_T("1/30"),
_T("1/15"),
_T("1/8"),
_T("1/4"),
_T("1/2"),
_T("1"),
_T("2"),
_T("4"),
_T("8"),
_T("15"),
_T("30"),
};
BOOL CExposureDialog::OnInitDialog()
{
CDialog::OnInitDialog();
CSliderCtrl* pAperture = (CSliderCtrl*) GetDlgItem(IDC_APERTURE);
CSliderCtrl* pShutter = (CSliderCtrl*) GetDlgItem(IDC_SHUTTER);
pAperture->SetRange(0, ELEMENTS(pstrAperture)-1);
pShutter->SetRange(0, ELEMENTS(pstrShutter)-1);
pAperture->ClearTics(TRUE);
int nIndex;
for (nIndex = 0; nIndex < ELEMENTS(pstrAperture); nIndex++)
pAperture->SetTic(nIndex);
SetDlgItemText(IDC_FSTOP, pstrAperture[0]);
SetDlgItemText(IDC_SPEED, pstrShutter[0]);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CExposureDialog::OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
int nPosition;
int nControl = pScrollBar->GetDlgCtrlID();
CSliderCtrl* pControl = (CSliderCtrl*) GetDlgItem(nControl);
switch (nControl)
{
case IDC_APERTURE:
ASSERT(pControl != NULL);
nPosition = pControl->GetPos();
GetDlgItem(IDC_FSTOP)->SetWindowText(pstrAperture[nPosition]);
break;
case IDC_SHUTTER:
ASSERT(pControl != NULL);
nPosition = pControl->GetPos();
GetDlgItem(IDC_SPEED)->SetWindowText(pstrShutter[nPosition]);
break;
default:
CDialog::OnHScroll(nSBCode, nPos, pScrollBar);
break;
}
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -