ColorBitsDlg.cpp
上传用户:hstieta88
上传日期:2007-01-14
资源大小:106k
文件大小:3k
源码类别:

图形图像处理

开发平台:

Visual C++

  1. // ColorBitsDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "Dib.h"
  5. #include "ColorProcess.h"
  6. #include "ColorBitsDlg.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CColorBitsDlg dialog
  14. CColorBitsDlg::CColorBitsDlg(int nColorBits, CWnd* pParent /*=NULL*/)
  15. : CDialog(CColorBitsDlg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CColorBitsDlg)
  18. // NOTE: the ClassWizard will add member initialization here
  19. //}}AFX_DATA_INIT
  20. m_nColorBits = nColorBits;
  21. }
  22. void CColorBitsDlg::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(CColorBitsDlg)
  26. // NOTE: the ClassWizard will add DDX and DDV calls here
  27. //}}AFX_DATA_MAP
  28. }
  29. BEGIN_MESSAGE_MAP(CColorBitsDlg, CDialog)
  30. //{{AFX_MSG_MAP(CColorBitsDlg)
  31. ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
  32. ON_BN_CLICKED(IDC_RADIO24, OnRadio24)
  33. ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
  34. ON_BN_CLICKED(IDC_RADIO8, OnRadio8)
  35. //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // CColorBitsDlg message handlers
  39. BOOL CColorBitsDlg::OnInitDialog() 
  40. {
  41. CDialog::OnInitDialog();
  42. switch (m_nColorBits)
  43. {
  44. case 1:
  45. ((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(1);
  46. ((CButton *)GetDlgItem(IDC_RADIO4))->SetCheck(0);
  47. ((CButton *)GetDlgItem(IDC_RADIO8))->SetCheck(0);
  48. ((CButton *)GetDlgItem(IDC_RADIO24))->SetCheck(0);
  49. break;
  50. case 4:
  51. ((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(0);
  52. ((CButton *)GetDlgItem(IDC_RADIO4))->SetCheck(1);
  53. ((CButton *)GetDlgItem(IDC_RADIO8))->SetCheck(0);
  54. ((CButton *)GetDlgItem(IDC_RADIO24))->SetCheck(0);
  55. break;
  56. case 8:
  57. ((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(0);
  58. ((CButton *)GetDlgItem(IDC_RADIO4))->SetCheck(0);
  59. ((CButton *)GetDlgItem(IDC_RADIO8))->SetCheck(1);
  60. ((CButton *)GetDlgItem(IDC_RADIO24))->SetCheck(0);
  61. break;
  62. case 24:
  63. ((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(0);
  64. ((CButton *)GetDlgItem(IDC_RADIO4))->SetCheck(0);
  65. ((CButton *)GetDlgItem(IDC_RADIO8))->SetCheck(0);
  66. ((CButton *)GetDlgItem(IDC_RADIO24))->SetCheck(1);
  67. break;
  68. }
  69. return TRUE;  // return TRUE unless you set the focus to a control
  70.               // EXCEPTION: OCX Property Pages should return FALSE
  71. }
  72. void CColorBitsDlg::OnRadio1() 
  73. {
  74. ((CButton *)GetDlgItem(IDC_RADIO1))->SetCheck(1);
  75. m_nColorBits = 1;
  76. }
  77. void CColorBitsDlg::OnRadio24() 
  78. {
  79. ((CButton *)GetDlgItem(IDC_RADIO24))->SetCheck(1);
  80. m_nColorBits = 24;
  81. }
  82. void CColorBitsDlg::OnRadio4() 
  83. {
  84. ((CButton *)GetDlgItem(IDC_RADIO4))->SetCheck(1);
  85. m_nColorBits = 4;
  86. }
  87. void CColorBitsDlg::OnRadio8() 
  88. {
  89. ((CButton *)GetDlgItem(IDC_RADIO8))->SetCheck(1);
  90. m_nColorBits = 8;
  91. }