FogDlg.cpp 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. /*************************************************************************************************\
  2. FogDlg.cpp : Implementation of the FogDlg component.
  3. //---------------------------------------------------------------------------//
  4. // Copyright (C) Microsoft Corporation. All rights reserved. //
  5. //===========================================================================//
  6. \*************************************************************************************************/
  7. #include "FogDlg.h"
  8. #include "resource.h"
  9. /////////////////////////////////////////////////////////////////////////////
  10. // FogDlg dialog
  11. FogDlg::FogDlg(CWnd* pParent /*=NULL*/)
  12. : CDialog(FogDlg::IDD, pParent)
  13. {
  14. //{{AFX_DATA_INIT(FogDlg)
  15. m_blue = 0;
  16. m_green = 0;
  17. m_red = 0;
  18. m_start = 0.0f;
  19. m_end = 0.0f;
  20. //}}AFX_DATA_INIT
  21. }
  22. void FogDlg::DoDataExchange(CDataExchange* pDX)
  23. {
  24. CDialog::DoDataExchange(pDX);
  25. //{{AFX_DATA_MAP(FogDlg)
  26. DDX_Text(pDX, IDC_BLUE1, m_blue);
  27. DDX_Text(pDX, IDC_GREEN1, m_green);
  28. DDX_Text(pDX, IDC_RED1, m_red);
  29. DDX_Text(pDX, IDC_START, m_start);
  30. DDX_Text(pDX, IDC_END, m_end);
  31. //}}AFX_DATA_MAP
  32. }
  33. BEGIN_MESSAGE_MAP(FogDlg, CDialog)
  34. //{{AFX_MSG_MAP(FogDlg)
  35. ON_EN_CHANGE(IDC_BLUE1, OnChangeBlue1)
  36. ON_EN_CHANGE(IDC_GREEN1, OnChangeBlue1)
  37. ON_EN_CHANGE(IDC_RED1, OnChangeBlue1)
  38. ON_WM_CTLCOLOR()
  39. //}}AFX_MSG_MAP
  40. END_MESSAGE_MAP()
  41. /////////////////////////////////////////////////////////////////////////////
  42. // FogDlg message handlers
  43. void FogDlg::OnChangeBlue1()
  44. {
  45. RedrawWindow();
  46. }
  47. HBRUSH FogDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
  48. {
  49. if ( CTLCOLOR_STATIC == nCtlColor && GetDlgItem( IDC_SOURCE_COLOR )->m_hWnd == pWnd->m_hWnd )
  50. {
  51. UpdateData( );
  52. if ( brush.m_hObject )
  53. brush.DeleteObject();
  54. brush.CreateSolidBrush(RGB(m_red, m_green, m_blue));
  55. return (HBRUSH)brush.m_hObject;
  56. }
  57. HBRUSH hbr = CDialog ::OnCtlColor(pDC, pWnd, nCtlColor);
  58. // TODO: Change any attributes of the DC here
  59. // TODO: Return a different brush if the default is not desired
  60. return hbr;
  61. }