// PicSizeDlg.cpp : implementation file // #include "stdafx.h" #include "PicSizeDlg.h" extern void DrawColorButton(LPDRAWITEMSTRUCT lpDIS,COLORREF clrButton); #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif ///////////////////////////////////////////////////////////////////////////// // CPicSizeDlg dialog CPicSizeDlg::CPicSizeDlg(CWnd* pParent /*=NULL*/) : CDialog(CPicSizeDlg::IDD, pParent) { //{{AFX_DATA_INIT(CPicSizeDlg) m_nPictureHeight = 0; m_nPictureWidth = 0; m_nGridSize = 30; m_bGrid = FALSE; //}}AFX_DATA_INIT } void CPicSizeDlg::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); //{{AFX_DATA_MAP(CPicSizeDlg) DDX_Text(pDX, IDC_PIC_HEIGHT, m_nPictureHeight); DDX_Text(pDX, IDC_PIC_WIDTH, m_nPictureWidth); DDX_Text(pDX, IDC_GRIDSIZE, m_nGridSize); DDX_Check(pDX, IDC_CHECK_SHOWGRID, m_bGrid); //}}AFX_DATA_MAP } BEGIN_MESSAGE_MAP(CPicSizeDlg, CDialog) //{{AFX_MSG_MAP(CPicSizeDlg) ON_BN_CLICKED(IDC_BACKCOLOR, OnBackcolor) ON_WM_DRAWITEM() //}}AFX_MSG_MAP END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // CPicSizeDlg message handlers void CPicSizeDlg::OnBackcolor() { // TODO: Add your control notification handler code here CColorDialog dlg(m_clrBack); if(dlg.DoModal()==IDOK) { m_clrBack = dlg.GetColor(); CButton *pButton = (CButton *)GetDlgItem(IDC_BACKCOLOR); pButton->ShowWindow(SW_HIDE); pButton->ShowWindow(SW_SHOW); } } void CPicSizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct) { // TODO: Add your message handler code here and/or call default if(nIDCtl==IDC_BACKCOLOR) DrawColorButton(lpDrawItemStruct,m_clrBack); CDialog::OnDrawItem(nIDCtl, lpDrawItemStruct); }