Click here to Skip to main content
15,881,248 members
Articles / Programming Languages / C++

BasicAdmin2 - Personal Finance Software

Rate me:
Please Sign up or sign in to vote.
4.58/5 (8 votes)
4 Nov 2011CPOL3 min read 38.8K   5.9K   32  
Utility to keep track of your finances
// ViewPrintPreview.cpp : implementation file
//

#include "stdafx.h"
#include "ViewPrintPreview.h"
#include <afxcontrolbars.h>     // MFC support for ribbons and control bars

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CViewPrintPreview

IMPLEMENT_DYNCREATE(CViewPrintPreview, CView)

CViewPrintPreview::CViewPrintPreview()
{
	m_pOldFrame=NULL;
}

CViewPrintPreview::~CViewPrintPreview()
{
}


BEGIN_MESSAGE_MAP(CViewPrintPreview, CView)
	//{{AFX_MSG_MAP(CViewPrintPreview)
	ON_BN_CLICKED(ID_FILE_PRINT, OnBnClickedImp)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CViewPrintPreview drawing

void CViewPrintPreview::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
}

/////////////////////////////////////////////////////////////////////////////
// CViewPrintPreview diagnostics

#ifdef _DEBUG
void CViewPrintPreview::AssertValid() const
{
	CView::AssertValid();
}

void CViewPrintPreview::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CViewPrintPreview message handlers

void CViewPrintPreview::OnFilePrintPreview()
{
	AFXPrintPreview(this);
	//CView::OnFilePrintPreview();
}

BOOL CViewPrintPreview::OnPreparePrinting(CPrintInfo* pInfo) 
{
	return DoPreparePrinting(pInfo);
}

void CViewPrintPreview::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo) 
{
	m_pCtrl->OnBeginPrinting(pDC, pInfo);
}

void CViewPrintPreview::OnPrint(CDC* pDC, CPrintInfo* pInfo) 
{
	m_pCtrl->OnPrint(pDC, pInfo);
	//CMainFrame* pDato = (CMainFrame*)(AfxGetMainWnd( ));
	//pDato->RefreshPages(pInfo->GetMaxPage(), pInfo->m_nCurPage);
}

void CViewPrintPreview::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo) 
{
	m_pCtrl->OnEndPrinting(pDC, pInfo);
}

void CViewPrintPreview::OnEndPrintPreview(CDC* pDC, CPrintInfo* pInfo, POINT point, CPreviewView* pView) 
{
	CView::OnEndPrintPreview(pDC, pInfo, point, pView);
	// Show the original frame

	CMDIChildWndEx* pDato = (CMDIChildWndEx*)pant->GetParent();
	//pDato->CambiarCantRows(nrows);
	//pant->ShowWindow(SW_SHOW);

	::SetWindowLong(this->m_hWnd, GWL_ID, 0);
	::SetWindowLong(pant->m_hWnd, GWL_ID, AFX_IDW_PANE_FIRST);
	
	pant->ShowWindow(SW_SHOW);
	this->ShowWindow(SW_HIDE);

	pDato->RecalcLayout();
	if (IsSplitter)
	{
		CSplitterWnd* sp = (CSplitterWnd*)pant;
		sp->RecalcLayout();
	}

	this->DestroyWindow();
}
void CViewPrintPreview::OnBnClickedImp()
{
	m_pCtrl->Print();
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer
Argentina Argentina
System developer from Argentina.

Programmed in VB 5,6,.NET, C#, Java, PL-SQL, Transac-SQL, C, C++ and even some "calculator" language.

Love to build small, useful applications.
Usually building big and complicated apps based on solid, reliable components.

Hobbies: reading, photography, chess, paddle, running.

Comments and Discussions