Objective Grid: Printing a grid embedded in a dialog or form view

Article ID: 336
Last updated: 07 Jun, 2018
Article ID: 336
Last updated: 07 Jun, 2018
Revision: 3
Views: 2073
Posted: 12 Jan, 2001
by Meltreger B.
Updated: 07 Jun, 2018
by Meltreger B.

Problem


How can I print a grid that is embedded in a CDialog or CFormView?


Cause



Action


Take a look at the formvw1.cpp file in gridapp. The key is to override the printing functions of the form view and delegate them to the grid.

Example:

void CSample1FormView::OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo)
{
    m_wndGrid.OnGridBeginPrinting(pDC, pInfo);
} 
void CSample1FormView::OnEndPrinting(CDC* pDC, CPrintInfo* pInfo)
{
    m_wndGrid.OnGridEndPrinting(pDC, pInfo);
}
void CSample1FormView::OnPrint(CDC* pDC, CPrintInfo* pInfo)
{
    m_wndGrid.OnGridPrint(pDC, pInfo);
}
void CSample1FormView::OnPrepareDC(CDC* pDC, CPrintInfo* pInfo /* = NULL */)
{
    m_wndGrid.OnGridPrepareDC(pDC, pInfo);
} 

If you are using the grid in a dialog take a look at the Printing sample. This sample implements a dialog-derivative with printing functionality

This article was:   Helpful | Not helpful
Report an issue
Article ID: 336
Last updated: 07 Jun, 2018
Revision: 3
Views: 2073
Posted: 12 Jan, 2001 by Meltreger B.
Updated: 07 Jun, 2018 by Meltreger B.

Others in this category