home *** CD-ROM | disk | FTP | other *** search
/ Mastering Visual Basic 6 / mastvb6.iso / leadtools / ocx32.lt / OPENOPT.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-10  |  2.5 KB  |  120 lines

  1. // openopt.cpp : implementation file
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "mfcdemo.h"
  6. #include "openopt.h"
  7.  
  8. #ifdef _DEBUG
  9. #undef THIS_FILE
  10. static char BASED_CODE THIS_FILE[] = __FILE__;
  11. #endif
  12.  
  13. /////////////////////////////////////////////////////////////////////////////
  14. // COpenOptDlg dialog
  15.  
  16.  
  17. COpenOptDlg::COpenOptDlg(CWnd* pParent /*=NULL*/)
  18.     : CDialog(COpenOptDlg::IDD, pParent)
  19. {
  20.     //{{AFX_DATA_INIT(COpenOptDlg)
  21.                 m_nBitsPerPixel = 0;
  22.             m_nPage = 1;
  23.     //}}AFX_DATA_INIT
  24. }
  25.  
  26.  
  27. void COpenOptDlg::DoDataExchange(CDataExchange* pDX)
  28. {
  29.     CDialog::DoDataExchange(pDX);
  30.     //{{AFX_DATA_MAP(COpenOptDlg)
  31.     DDX_Text(pDX, IDC_EDIT1, m_nPage);
  32.     //}}AFX_DATA_MAP
  33. }
  34.  
  35.  
  36. BEGIN_MESSAGE_MAP(COpenOptDlg, CDialog)
  37.     //{{AFX_MSG_MAP(COpenOptDlg)
  38.     ON_BN_CLICKED(IDC_RADIO1, OnRadio1)
  39.     ON_BN_CLICKED(IDC_RADIO2, OnRadio2)
  40.     ON_BN_CLICKED(IDC_RADIO3, OnRadio3)
  41.     ON_BN_CLICKED(IDC_RADIO4, OnRadio4)
  42.     ON_BN_CLICKED(IDC_RADIO5, OnRadio5)
  43.     ON_BN_CLICKED(IDC_RADIO6, OnRadio6)
  44.     ON_BN_CLICKED(IDC_RADIO7, OnRadio7)
  45.     //}}AFX_MSG_MAP
  46. END_MESSAGE_MAP()
  47.  
  48.  
  49. /////////////////////////////////////////////////////////////////////////////
  50. // COpenOptDlg message handlers
  51.  
  52. BOOL COpenOptDlg::OnInitDialog() 
  53. {
  54.     CDialog::OnInitDialog();
  55.     
  56.         switch(m_nBitsPerPixel)
  57.         {
  58.         case 1:
  59.                 CheckDlgButton (IDC_RADIO1, TRUE);
  60.                 break;
  61.         case 4:
  62.                 CheckDlgButton (IDC_RADIO2, TRUE);
  63.                 break;
  64.         case 8:
  65.                 CheckDlgButton (IDC_RADIO3, TRUE);
  66.                 break;
  67.         case 16:
  68.                 CheckDlgButton (IDC_RADIO4, TRUE);
  69.                 break;
  70.         case 24:
  71.                 CheckDlgButton (IDC_RADIO5, TRUE);
  72.                 break;
  73.         case 32:
  74.                 CheckDlgButton (IDC_RADIO6, TRUE);
  75.                 break;
  76.         default:
  77.                 CheckDlgButton (IDC_RADIO7, TRUE);
  78.                 break;
  79.         }
  80.     
  81.     return TRUE;  // return TRUE unless you set the focus to a control
  82.                   // EXCEPTION: OCX Property Pages should return FALSE
  83. }
  84.  
  85.  
  86. void COpenOptDlg::OnRadio1() 
  87. {
  88.         m_nBitsPerPixel = 1;
  89. }
  90.  
  91. void COpenOptDlg::OnRadio2() 
  92. {
  93.         m_nBitsPerPixel = 4;
  94. }
  95.  
  96. void COpenOptDlg::OnRadio3() 
  97. {
  98.         m_nBitsPerPixel = 8;
  99. }
  100.  
  101. void COpenOptDlg::OnRadio4() 
  102. {
  103.         m_nBitsPerPixel = 16;
  104. }
  105.  
  106. void COpenOptDlg::OnRadio5() 
  107. {
  108.         m_nBitsPerPixel = 24;
  109. }
  110.  
  111. void COpenOptDlg::OnRadio6() 
  112. {
  113.         m_nBitsPerPixel = 32;
  114. }
  115.  
  116. void COpenOptDlg::OnRadio7() 
  117. {
  118.         m_nBitsPerPixel = 0;
  119. }
  120.