【VC开源代码栏目提醒】:网学会员在VC开源代码频道为大家收集整理了ColorBitsDlg.cpp提供大家参考,希望对大家有所帮助!
// ColorBitsDlg.cpp : implementation file
//
#include "stdafx.h"
#include "imageCAM.h"
#include "Dib.h"
#include "ColorBitsDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CColorBitsDlg dialog
CColorBitsDlg::CColorBitsDlg(int nColorBits,CWnd* pParent /*=NULL*/)
: CDialog(CColorBitsDlg::IDD, pParent)
{
//{{AFX_DATA_INIT(CColorBitsDlg)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
m_nColorBits = nColorBits;
}
void CColorBitsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CColorBitsDlg)
// NOTE: the ClassWizard will add DDX and DDV calls here
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CColorBitsDlg, CDialog)
//{{AFX_MSG_MAP(CColorBitsDlg)
ON_BN_CLICKED(IDC_RADIO24, OnRadio24)
ON_BN_CLICKED(IDC_RADIO8, OnRadio8)
ON_BN_CLICKED(IDC_RADIO22, OnRadio22)
ON_BN_CLICKED(IDC_RADIO11, OnRadio11)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CColorBitsDlg message handlers
void CColorBitsDlg::OnRadio24()
{
// TODO: Add your control notification handler code here
((CButton *)GetDlgItem(IDC_RADIO24))->SetCheck(1);
m_nColorBits = 24;
}
void CColorBitsDlg::OnRadio8()
{
// TODO: Add your control notification handler code here
((CButton *)GetDlgItem(IDC_RADIO8))->SetCheck(1);
m_nColorBits = 8;
}
void CColorBitsDlg::OnRadio22()
{
// TODO: Add your control notification handler code here
((CButton *)GetDlgItem(IDC_RADIO22))->SetCheck(1);
m_nColorBits = 4;
}
void CColorBitsDlg::OnRadio11()
{
// TODO: Add your control notification handler code here
((CButton *)GetDlgItem(IDC_RADIO11))->SetCheck(1);
m_nColorBits = 1;
}
BOOL CColorBitsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
switch (m_nColorBits)
{
case 1:
((CButton *)GetDlgItem(IDC_RADIO11))->SetCheck(1);
((CButton *)GetDlgItem(IDC_RADIO22))->SetCheck(0);
((CButton *)GetDlgItem(IDC_RADIO8))->SetCheck(0);
((CButton *)GetDlgItem(IDC_RADIO24))->SetCheck(0);
break;
case 4:
((CButton *)GetDlgItem(IDC_RADIO11))->SetCheck(0);
((CButton *)GetDlgItem(IDC_RADIO22))->SetCheck(1);
((CButton *)GetDlgItem(IDC_RADIO8))->SetCheck(0);
((CButton *)GetDlgItem(IDC_RADIO24))->SetCheck(0);
break;
case 8:
((CButton *)GetDlgItem(IDC_RADIO11))->SetCheck(0);
((CButton *)GetDlgItem(IDC_RADIO22))->SetCheck(0);
((CButton *)GetDlgItem(IDC_RADIO8))->SetCheck(1);
((CButton *)GetDlgItem(IDC_RADIO24))->SetCheck(0);
break;
case 24:
((CButton *)GetDlgItem(IDC_RADIO11))->SetCheck(0);
((CButton *)GetDlgItem(IDC_RADIO22))->SetCheck(0);
((CButton *)GetDlgItem(IDC_RADIO8))->SetCheck(0);
((CButton *)GetDlgItem(IDC_RADIO24))->SetCheck(1);
break;
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}