123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129 |
- // 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);
- }
- /////////////////////////////////////////////////////////////////////////////
- // CInsertDeviceDlg dialog
- CInsertDeviceDlg::CInsertDeviceDlg(CWnd* pParent /*=NULL*/)
- : CDialog(CInsertDeviceDlg::IDD, pParent)
- {
- //{{AFX_DATA_INIT(CInsertDeviceDlg)
- m_strDevice = _T("");
- //}}AFX_DATA_INIT
- }
- void CInsertDeviceDlg::DoDataExchange(CDataExchange* pDX)
- {
- CDialog::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CInsertDeviceDlg)
- DDX_LBString(pDX, IDC_LIST_DEVICE, m_strDevice);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CInsertDeviceDlg, CDialog)
- //{{AFX_MSG_MAP(CInsertDeviceDlg)
- ON_LBN_DBLCLK(IDC_LIST_DEVICE, OnDblclkList)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CInsertDeviceDlg message handlers
- BOOL CInsertDeviceDlg::OnInitDialog()
- {
- CDialog::OnInitDialog();
-
- // TODO: Add extra initialization here
- CListBox* pList = (CListBox*)GetDlgItem(IDC_LIST_DEVICE);
- #if 0
- POSITION pos = CDevice::mapDevices.GetStartPosition();
- while(pos!=NULL)
- {
- void* pType;
- CString strType;
- CDevice::mapDevices.GetNextAssoc(pos,strType,pType);
- pList->AddString(strType);
- }
- pList->SetCurSel(0);
- #endif
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }
- void CInsertDeviceDlg::OnDblclkList()
- {
- // TODO: Add your control notification handler code here
- UpdateData(TRUE);
- EndDialog(IDOK);
- }
|