DlgTransparent.cpp
上传用户:yangxun008
上传日期:2008-03-25
资源大小:3863k
文件大小:3k
源码类别:

按钮控件

开发平台:

Visual C++

  1. // DlgTransparent.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "CButtonST_Demo.h"
  5. #include "DlgTransparent.h"
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. CDlgTransparent::CDlgTransparent(CWnd* pParent /*=NULL*/)
  12. : CBkDialog(CDlgTransparent::IDD, pParent)
  13. {
  14. //{{AFX_DATA_INIT(CDlgTransparent)
  15. // NOTE: the ClassWizard will add member initialization here
  16. //}}AFX_DATA_INIT
  17. m_bFirstTime = TRUE;
  18. }
  19. void CDlgTransparent::DoDataExchange(CDataExchange* pDX)
  20. {
  21. CBkDialog::DoDataExchange(pDX);
  22. //{{AFX_DATA_MAP(CDlgTransparent)
  23. // NOTE: the ClassWizard will add DDX and DDV calls here
  24. //}}AFX_DATA_MAP
  25. // Make our buttons a CButtonST buttons
  26. DDX_Control(pDX, IDC_BTNLOGOFF, m_btnLogOff);
  27. DDX_Control(pDX, IDC_BTNWORKGROUP, m_btnWorkgroup);
  28. DDX_Control(pDX, IDC_BTNOPEN, m_btnOpen);
  29. DDX_Control(pDX, IDC_BTNSEARCH, m_btnSearch);
  30. DDX_Control(pDX, IDC_BTNEXPLORER, m_btnExplorer);
  31. DDX_Control(pDX, IDC_BTNHELP, m_btnHelp);
  32. DDX_Control(pDX, IDC_BTNABOUT, m_btnAbout);
  33. DDX_Control(pDX, IDC_BTNCANNIBAL, m_btnCannibal);
  34. DDX_Control(pDX, IDC_CHECK, m_chkCheckbox);
  35. }
  36. BEGIN_MESSAGE_MAP(CDlgTransparent, CBkDialog)
  37. //{{AFX_MSG_MAP(CDlgTransparent)
  38. ON_WM_SETFOCUS()
  39. //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41. BOOL CDlgTransparent::OnInitDialog() 
  42. {
  43. CBkDialog::OnInitDialog();
  44. SetBitmap(IDB_SKY);
  45. // Log off button
  46. m_btnLogOff.SetIcon(IDI_LOGOFF);
  47. // Workgroup button
  48. m_btnWorkgroup.SetIcon(IDI_WORKGROUP);
  49. // Toolbar buttons
  50. m_btnOpen.SetIcon(IDI_OPEN, (int)BTNST_AUTO_GRAY);
  51. m_btnOpen.SetTooltipText(_T("Open"));
  52. m_btnSearch.SetIcon(IDI_SEARCH1, (int)BTNST_AUTO_GRAY);
  53. m_btnSearch.SetTooltipText(_T("Search"));
  54. m_btnExplorer.SetIcon(IDI_EXPLORER, (int)BTNST_AUTO_GRAY);
  55. m_btnExplorer.SetTooltipText(_T("Internet explorer"));
  56. m_btnHelp.SetIcon(IDI_HELP, (int)BTNST_AUTO_GRAY);
  57. m_btnHelp.SetTooltipText(_T("Help"));
  58. #ifdef BTNST_USE_BCMENU
  59. m_btnHelp.SetMenu(IDR_MENU, m_hWnd);
  60. #else
  61. m_btnHelp.SetMenu(IDR_MENU, m_hWnd);
  62. #endif
  63. m_btnAbout.SetIcon(IDI_ABOUT, (int)BTNST_AUTO_GRAY);
  64. m_btnAbout.SetTooltipText(_T("About"));
  65. // Cannibal button
  66. m_btnCannibal.SetBitmaps(IDB_CANNIBAL, RGB(0, 255, 0));
  67. // Checkbox
  68. m_chkCheckbox.SetIcon(IDI_LEDON, IDI_LEDOFF);
  69. return TRUE;
  70. } // End of OnInitDialog
  71. void CDlgTransparent::OnOK()
  72. {
  73. } // End of OnOK
  74. void CDlgTransparent::OnCancel()
  75. {
  76. } // End of OnCancel
  77. void CDlgTransparent::OnSetFocus(CWnd* pOldWnd) 
  78. {
  79. CBkDialog::OnSetFocus(pOldWnd);
  80. // Do only one time
  81. if (m_bFirstTime == TRUE)
  82. {
  83. m_bFirstTime = FALSE;
  84. m_btnLogOff.DrawTransparent(TRUE);
  85. m_btnWorkgroup.DrawTransparent(TRUE);
  86. m_btnOpen.DrawTransparent(TRUE);
  87. m_btnSearch.DrawTransparent(TRUE);
  88. m_btnExplorer.DrawTransparent(TRUE);
  89. m_btnHelp.DrawTransparent(TRUE);
  90. m_btnAbout.DrawTransparent(TRUE);
  91. m_btnCannibal.DrawTransparent(TRUE);
  92. m_chkCheckbox.DrawTransparent(TRUE);
  93. } // if
  94. } // End of OnSetFocus