PageSetupMarginsPage.cpp
上传用户:cding2008
上传日期:2007-01-03
资源大小:1812k
文件大小:4k
源码类别:
OpenGL
开发平台:
Visual C++
- // PageSetupMarginsPage.cpp : implementation file
- //
- #include "stdafx.h"
- #include "ModelMagic3D.h"
- #include "PageSetupMarginsPage.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CPageSetupMarginsPage local variables
- static CString szMargin[] = {"0.0"", "0.1"", "0.2"", "0.3"", "0.4"", "0.5"", "0.6"", "0.7"", "0.8"", "0.9"",
- "1.0"", "1.1"", "1.2"", "1.3"", "1.4"", "1.5"", "1.6"", "1.7"", "1.8"", "1.9"",
- "2.0"", "2.1"", "2.2"", "2.3"", "2.4"", "2.5"", "2.6"", "2.7"", "2.8"", "2.9"",
- "3.0"", "3.1"", "3.2"", "3.3"", "3.4"", "3.5"", "3.6"", "3.7"", "3.8"", "3.9"",
- "4.0"", "4.1"", "4.2"", "4.3"", "4.4"", "4.5"", "4.6"", "4.7"", "4.8"", "4.9"",
- "5.0"", "5.1"", "5.2"", "5.3"", "5.4"", "5.5"", "5.6"", "5.7"", "5.8"", "5.9"",
- "6.0"", "6.1"", "6.2"", "6.3"", "6.4"", "6.5"", "6.6"", "6.7"", "6.8"", "6.9"",
- "7.0"", "7.1"", "7.2"", "7.3"", "7.4"", "7.5"", "7.6"", "7.7"", "7.8"", "7.9"",
- };
- #define NUM_CHOICES 80
- /////////////////////////////////////////////////////////////////////////////
- // CPageSetupMarginsPage property page
- IMPLEMENT_DYNCREATE(CPageSetupMarginsPage, CPropertyPage)
- CPageSetupMarginsPage::CPageSetupMarginsPage() : CPropertyPage(CPageSetupMarginsPage::IDD)
- {
- m_pData = NULL;
- //{{AFX_DATA_INIT(CPageSetupMarginsPage)
- m_iRadioCenterImage = -1;
- //}}AFX_DATA_INIT
- }
- CPageSetupMarginsPage::~CPageSetupMarginsPage()
- {
- }
- void CPageSetupMarginsPage::DoDataExchange(CDataExchange* pDX)
- {
- CPropertyPage::DoDataExchange(pDX);
- //{{AFX_DATA_MAP(CPageSetupMarginsPage)
- DDX_Control(pDX, IDC_HEADER, m_ListHeaderMargin);
- DDX_Control(pDX, IDC_FOOTER, m_ListFooterMargin);
- DDX_Control(pDX, IDC_LEFT, m_ListLeftMargin);
- DDX_Control(pDX, IDC_RIGHT, m_ListRightMargin);
- DDX_Control(pDX, IDC_TOP, m_ListTopMargin);
- DDX_Control(pDX, IDC_BOTTOM, m_ListBottomMargin);
- DDX_Radio(pDX, IDC_RADIO_CENTER_IMAGE, m_iRadioCenterImage);
- //}}AFX_DATA_MAP
- }
- BEGIN_MESSAGE_MAP(CPageSetupMarginsPage, CPropertyPage)
- //{{AFX_MSG_MAP(CPageSetupMarginsPage)
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CPageSetupMarginsPage procedures
- void CPageSetupMarginsPage::LoadMarginListBox(CListBox* pList)
- {
- ASSERT(pList);
- // Reset or clear the contents of the list box and load our
- // default choices
- pList->ResetContent();
- for(int i=0; i<NUM_CHOICES; i++)
- pList->AddString(szMargin[i]);
- if(m_pData)
- {
- struct MARGIN_DATA* data = (struct MARGIN_DATA*)m_pData;
- CString szString;
- szString.Format("%1.1f"", data->fTop);
- int iRetn = pList->FindString(0, szString);
- if(iRetn)
- pList->SetCurSel(iRetn);
- }
- }
- /////////////////////////////////////////////////////////////////////////////
- // CPageSetupMarginsPage message handlers
- BOOL CPageSetupMarginsPage::OnInitDialog()
- {
- // let the base class do the default work
- CPropertyPage::OnInitDialog();
- // Load our margin list boxes
- LoadMarginListBox(&m_ListTopMargin);
- LoadMarginListBox(&m_ListBottomMargin);
- LoadMarginListBox(&m_ListLeftMargin);
- LoadMarginListBox(&m_ListRightMargin);
- LoadMarginListBox(&m_ListHeaderMargin);
- LoadMarginListBox(&m_ListFooterMargin);
- return TRUE; // return TRUE unless you set the focus to a control
- // EXCEPTION: OCX Property Pages should return FALSE
- }