FIX: Hatch Marks in MFC DRAWCLI Print PreviewLast reviewed: September 18, 1997Article ID: Q123162 |
1.50
WINDOWS
kbprint kbfixlist kbbuglist
The information in this article applies to:
SYMPTOMSAlthough hatching should never appear when using a print DC, under the conditions outlined in the "Steps to Reproduce Problem" section of this article, the active embedded item is represented with hatch marks across it in the print preview.
CAUSEThis is a bug in the DRAWCLI sample. The function CDrawOleObj::Draw draws the hatch marks across the item. The Draw function should check to see whether or not the DC passed to is a printer DC or a screen DC. Then based on the type of DC, the sample should either draw or not draw hatch marks. Presently, any item that is currently open (active) has hatching drawn across it regardless of the type of DC.
RESOLUTIONThe code to draw the rectangle tracker and the hatching over the item begins on line 1024 of DRAWOBJ.CPP. It can be found in the MSVC\MFC\SAMPLES\DRAWCLI directory. The code is the following:
// use a CRectTracker to draw the standard effects CRectTracker tracker; tracker.m_rect = m_position; pDC->LPtoDP(tracker.m_rect); if (c_bShowItems) { // put correct border depending on item type if (pItem->GetType() == OT_LINK) tracker.m_nStyle |= CRectTracker::dottedLine; else tracker.m_nStyle |= CRectTracker::solidLine; } // put hatching over the item if it is currently open if (pItem->GetItemState() == COleClientItem::openState || pItem->GetItemState() == COleClientItem::activeUIState) { tracker.m_nStyle |= CRectTracker::hatchInside; } tracker.Draw(pDC);Change the code to this:
// don't draw tracker in print preview or on printerif (!pDC->IsPrinting()) { // use a CRectTracker to draw the standard effects CRectTracker tracker; tracker.m_rect = m_position; pDC->LPtoDP(tracker.m_rect); if (c_bShowItems) { // put correct border depending on item type if (pItem->GetType() == OT_LINK) tracker.m_nStyle |= CRectTracker::dottedLine; else tracker.m_nStyle |= CRectTracker::solidLine; } // put hatching over the item if it is currently open if (pItem->GetItemState() == COleClientItem::openState || pItem->GetItemState() == COleClientItem::activeUIState) { tracker.m_nStyle |= CRectTracker::hatchInside; } tracker.Draw(pDC);}
STATUSMicrosoft has confirmed this to be a bug in the products listed at the beginning of this article. This bug was corrected in The Microsoft Foundation Classes, version 2.51, included with Visual C++ version 1.51.
MORE INFORMATION
Steps to Reproduce Problem
|
Additional reference words: 1.50 2.50
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |