PicSizeDlg.cpp 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // PicSizeDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "PicSizeDlg.h"
  5. extern void DrawColorButton(LPDRAWITEMSTRUCT lpDIS,COLORREF clrButton);
  6. #ifdef _DEBUG
  7. #define new DEBUG_NEW
  8. #undef THIS_FILE
  9. static char THIS_FILE[] = __FILE__;
  10. #endif
  11. /////////////////////////////////////////////////////////////////////////////
  12. // CPicSizeDlg dialog
  13. CPicSizeDlg::CPicSizeDlg(CWnd* pParent /*=NULL*/)
  14. : CDialog(CPicSizeDlg::IDD, pParent)
  15. {
  16. //{{AFX_DATA_INIT(CPicSizeDlg)
  17. m_nPictureHeight = 0;
  18. m_nPictureWidth = 0;
  19. m_nGridSize = 30;
  20. m_bGrid = FALSE;
  21. //}}AFX_DATA_INIT
  22. }
  23. void CPicSizeDlg::DoDataExchange(CDataExchange* pDX)
  24. {
  25. CDialog::DoDataExchange(pDX);
  26. //{{AFX_DATA_MAP(CPicSizeDlg)
  27. DDX_Text(pDX, IDC_PIC_HEIGHT, m_nPictureHeight);
  28. DDX_Text(pDX, IDC_PIC_WIDTH, m_nPictureWidth);
  29. DDX_Text(pDX, IDC_GRIDSIZE, m_nGridSize);
  30. DDX_Check(pDX, IDC_CHECK_SHOWGRID, m_bGrid);
  31. //}}AFX_DATA_MAP
  32. }
  33. BEGIN_MESSAGE_MAP(CPicSizeDlg, CDialog)
  34. //{{AFX_MSG_MAP(CPicSizeDlg)
  35. ON_BN_CLICKED(IDC_BACKCOLOR, OnBackcolor)
  36. ON_WM_DRAWITEM()
  37. //}}AFX_MSG_MAP
  38. END_MESSAGE_MAP()
  39. /////////////////////////////////////////////////////////////////////////////
  40. // CPicSizeDlg message handlers
  41. void CPicSizeDlg::OnBackcolor()
  42. {
  43. // TODO: Add your control notification handler code here
  44. CColorDialog dlg(m_clrBack);
  45. if(dlg.DoModal()==IDOK)
  46. {
  47. m_clrBack = dlg.GetColor();
  48. CButton *pButton = (CButton *)GetDlgItem(IDC_BACKCOLOR);
  49. pButton->ShowWindow(SW_HIDE);
  50. pButton->ShowWindow(SW_SHOW);
  51. }
  52. }
  53. void CPicSizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
  54. {
  55. // TODO: Add your message handler code here and/or call default
  56. if(nIDCtl==IDC_BACKCOLOR) DrawColorButton(lpDrawItemStruct,m_clrBack);
  57. CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct);
  58. }
  59. /////////////////////////////////////////////////////////////////////////////
  60. // CInsertDeviceDlg dialog
  61. CInsertDeviceDlg::CInsertDeviceDlg(CWnd* pParent /*=NULL*/)
  62. : CDialog(CInsertDeviceDlg::IDD, pParent)
  63. {
  64. //{{AFX_DATA_INIT(CInsertDeviceDlg)
  65. m_strDevice = _T("");
  66. //}}AFX_DATA_INIT
  67. }
  68. void CInsertDeviceDlg::DoDataExchange(CDataExchange* pDX)
  69. {
  70. CDialog::DoDataExchange(pDX);
  71. //{{AFX_DATA_MAP(CInsertDeviceDlg)
  72. DDX_LBString(pDX, IDC_LIST_DEVICE, m_strDevice);
  73. //}}AFX_DATA_MAP
  74. }
  75. BEGIN_MESSAGE_MAP(CInsertDeviceDlg, CDialog)
  76. //{{AFX_MSG_MAP(CInsertDeviceDlg)
  77. ON_LBN_DBLCLK(IDC_LIST_DEVICE, OnDblclkList)
  78. //}}AFX_MSG_MAP
  79. END_MESSAGE_MAP()
  80. /////////////////////////////////////////////////////////////////////////////
  81. // CInsertDeviceDlg message handlers
  82. BOOL CInsertDeviceDlg::OnInitDialog()
  83. {
  84. CDialog::OnInitDialog();
  85. // TODO: Add extra initialization here
  86. CListBox* pList = (CListBox*)GetDlgItem(IDC_LIST_DEVICE);
  87. #if 0
  88. POSITION pos = CDevice::mapDevices.GetStartPosition();
  89. while(pos!=NULL)
  90. {
  91. void* pType;
  92. CString strType;
  93. CDevice::mapDevices.GetNextAssoc(pos,strType,pType);
  94. pList->AddString(strType);
  95. }
  96. pList->SetCurSel(0);
  97. #endif
  98. return TRUE; // return TRUE unless you set the focus to a control
  99. // EXCEPTION: OCX Property Pages should return FALSE
  100. }
  101. void CInsertDeviceDlg::OnDblclkList()
  102. {
  103. // TODO: Add your control notification handler code here
  104. UpdateData(TRUE);
  105. EndDialog(IDOK);
  106. }