myrecvw.cpp
来自「mfc internals 源码 mfc internals 源码」· C++ 代码 · 共 222 行
CPP
222 行
// gxrecvw.cpp : implementation file
//
// This is a part of the Objective Grid C++ Library.
// Copyright (C) 1995 ClassWorks, Stefan Hoenig.
// All rights reserved.
//
// This source code is only intended as a supplement to
// the Objective Grid Classes Reference and related
// electronic documentation provided with the library.
// See these sources for detailed information regarding
// the Objective Grid product.
//
#include "stdafx.h"
#include "resource.h"
#include "myrecvw.h"
#ifndef _GXPRPDLG_H_
#include "gxprpdlg.h"
#endif
#ifdef _DEBUG
#undef THIS_FILE
static char BASED_CODE THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CMyRecordView
IMPLEMENT_DYNAMIC(CMyRecordView, CGXRecordView)
CMyRecordView::CMyRecordView()
{
}
CMyRecordView::~CMyRecordView()
{
}
BEGIN_MESSAGE_MAP(CMyRecordView, CGXRecordView)
//{{AFX_MSG_MAP(CMyRecordView)
ON_COMMAND(ID_FILE_HEADERFOOTER, OnFileHeaderfooter)
ON_COMMAND(ID_FILE_PAGE_SETUP, OnFilePageSetup)
ON_COMMAND(ID_FORMAT_STYLES, OnFormatStyles)
ON_COMMAND(ID_VIEW_PROPERTIES, OnViewProperties)
//}}AFX_MSG_MAP
ON_UPDATE_COMMAND_UI(ID_EDIT_UNDORECORD, CGXRecordView::OnUpdateEditUndorecord)
ON_COMMAND(ID_EDIT_UNDORECORD, CGXRecordView::OnEditUndorecord)
ON_COMMAND(ID_RECORD_DELETE, CGXRecordView::OnRecordDelete)
ON_UPDATE_COMMAND_UI(ID_RECORD_DELETE, CGXRecordView::OnUpdateRecordDelete)
ON_COMMAND(ID_VIEW_ZOOMIN, CGXRecordView::OnViewZoomin)
ON_COMMAND(ID_VIEW_100, CGXRecordView::OnView100)
ON_COMMAND(ID_VIEW_ZOOMOUT, CGXRecordView::OnViewZoomout)
ON_COMMAND(ID_FORMAT_FREEZECOLS, CGXRecordView::OnFormatFreezecols)
ON_COMMAND(ID_FORMAT_UNFREEZECOLS, CGXRecordView::OnFormatUnfreezecols)
ON_UPDATE_COMMAND_UI(ID_FORMAT_UNFREEZECOLS, CGXRecordView::OnUpdateFormatUnfreezecols)
ON_UPDATE_COMMAND_UI(ID_VIEW_ZOOMIN, CGXRecordView::OnUpdateViewZoomin)
ON_UPDATE_COMMAND_UI(ID_VIEW_ZOOMOUT, CGXRecordView::OnUpdateViewZoomout)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CMyRecordView diagnostics
#ifdef _DEBUG
void CMyRecordView::AssertValid() const
{
CGXGridView::AssertValid();
}
void CMyRecordView::Dump(CDumpContext& dc) const
{
CGXGridView::Dump(dc);
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// File menu handlers
void CMyRecordView::OnFilePageSetup()
{
BOOL bSaveDefault = FALSE;
CGXProperties* pPropertyObj = GetParam()->GetProperties();
ASSERT(pPropertyObj->IsKindOf(RUNTIME_CLASS(CGXProperties)));
CGXProperties* pNewSettings = new CGXProperties;
*pNewSettings = *pPropertyObj;
CGXPrintPropertiesDialog dlg(pNewSettings, GetParam()->GetStylesMap(), &bSaveDefault, FALSE);
int result = dlg.DoModal();
if (result == IDOK)
{
*pPropertyObj = *pNewSettings;
if (bSaveDefault)
pPropertyObj->WriteProfile();
SetModifiedFlag();
}
delete pNewSettings;
}
void CMyRecordView::OnFileHeaderfooter()
{
BOOL bSaveDefault = FALSE;
CGXProperties* pPropertyObj = GetParam()->GetProperties();
ASSERT(pPropertyObj->IsKindOf(RUNTIME_CLASS(CGXProperties)));
CGXProperties* pNewSettings = new CGXProperties;
*pNewSettings = *pPropertyObj;
CGXHeaderFooterDialog dlg(pNewSettings, &bSaveDefault);
int result = dlg.DoModal();
if (result == IDOK)
{
*pPropertyObj = *pNewSettings;
if (bSaveDefault)
pPropertyObj->WriteProfile();
SetModifiedFlag();
}
delete pNewSettings;
}
/////////////////////////////////////////////////////////////////////////////
// Format menu handlers
void CMyRecordView::OnFormatStyles()
{
CMyStylesDialog dlg;
CGXStylesMap& map = *GetParam()->GetStylesMap();
dlg.SetStylesMap(map);
if (dlg.DoModal() == IDOK)
{
map = dlg.GetStylesMap();
Redraw();
}
}
/////////////////////////////////////////////////////////////////////////////
// View menu handlers
void CMyRecordView::OnViewProperties()
{
BOOL bSaveDefault = FALSE;
CGXProperties* pPropertyObj = GetParam()->GetProperties();
ASSERT(pPropertyObj->IsKindOf(RUNTIME_CLASS(CGXProperties)));
CGXProperties* pNewSettings = new CGXProperties;
*pNewSettings = *pPropertyObj;
CGXDisplayPropertiesDialog dlg(pNewSettings, GetParam()->GetStylesMap(), &bSaveDefault, FALSE);
int result = dlg.DoModal();
if (result == IDOK)
{
*pPropertyObj = *pNewSettings;
if (bSaveDefault)
pPropertyObj->WriteProfile();
SetModifiedFlag();
Redraw();
}
delete pNewSettings;
}
/////////////////////////////////////////////////////////////////////////////
// CMyStylesDialog
CMyStylesDialog::CMyStylesDialog(CWnd* pParent)
: CGXStylesDialog(pParent)
{
}
CGXStyleSheet* CMyStylesDialog::CreateStyleSheet()
{
return new CMyStyleSheet(m_sStyle, m_StylesMap);
}
/////////////////////////////////////////////////////////////////////////////
// CMyStyleSheet
CMyStyleSheet::CMyStyleSheet(UINT nIDCaption, CGXStylesMap& stylesMap, CWnd* pParentWnd, UINT iSelectPage)
:CGXStyleSheet(nIDCaption, stylesMap, pParentWnd, iSelectPage)
{
}
CMyStyleSheet::CMyStyleSheet(LPCTSTR pszCaption, CGXStylesMap& stylesMap, CWnd* pParentWnd, UINT iSelectPage)
:CGXStyleSheet(pszCaption, stylesMap, pParentWnd, iSelectPage)
{
}
void CMyStyleSheet::CreatePages()
{
m_pFontPage = CreateFontPage();
m_pColorPage = CreateColorPage();
m_pBorderPage = CreateBorderPage();
m_pAlignmentPage = CreateAlignmentPage();
#if _MFC_VER < 0x0300 && defined(USE_TABDLG)
AddPage(m_pFontPage, "Font");
AddPage(m_pColorPage, "Color");
AddPage(m_pBorderPage, "Border");
AddPage(m_pAlignmentPage, "Align");
#else
AddPage(m_pFontPage);
AddPage(m_pColorPage);
AddPage(m_pBorderPage);
AddPage(m_pAlignmentPage);
#endif
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?