Objective Grid: Positioning the grid when printing

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

Problem


I want to print information around the grid (e.g. text above, below and to the left/right). Is it possible to specify where on the printed page Objective Grid will print?


Cause



Action


Sure, just override these two virtual functions:

void CGXGridCore::OnAdjustPrintRectangle(CDC* /*pDC*/, CPrintInfo* pInfo)
{
CGXGridParam* pParam = GetParam();
CGXProperties* pProp = pParam->GetProperties();

// subtract left, right, bottom and top Frame
int nTop, nLeft, nBottom, nRight;

pProp->GetMargins(nTop, nLeft, nBottom, nRight);
pInfo->m_rectDraw.top += nTop;
pInfo->m_rectDraw.left += nLeft;
pInfo->m_rectDraw.bottom -= nBottom;
pInfo->m_rectDraw.right -= nRight;

}

Or simply set the margins by calling:

GetProperties()->SetMargins(nTop, nLeft, nBottom, nRight);

The next member function is responsible for drawing the outside area:

void CGXGridCore::OnPrintHeaderAndFooter(CDC* pDC, CPrintInfo* pInfo)
{
CGXGridParam* pParam = GetParam();
CGXProperties* pProp = pParam->GetProperties();
CDocument* pDoc = NULL;

if (m_pGridWnd->IsKindOf(RUNTIME_CLASS(CView)))

pDoc = ((CView*) m_pGridWnd)->GetDocument();
pProp->OnPrintHeaderAndFooter(pDC, pInfo, pDoc, pParam);
}

So you could override this and add your own code instead of calling:

pProp->OnPrintHeaderAndFooter();

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

Others in this category