Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Print preview and Property Grid Collapse All
Subject Author Date
Bogdan Munteanu Aug 27, 2010 - 4:24 AM

The print preview feature in the project PropertyGrid, colors the property names in black. Is there a setup one could use to change that and make the info visible?


I sent you also an email with a snapshot showing this issue ( I used VS 2008 on Windows XP Ultimate with the latest patches).


 


Thank you,


Bogdan

Bogdan Munteanu Aug 29, 2010 - 7:36 PM

It worked. Thank you!

Offer Har Aug 28, 2010 - 5:51 AM

This is the call-stack when it crashes with the dialog enlarged so no scrolling is needed to cause a crash:



>    ProfUIS290md.dll!CExtTreeGridDataProvider::_Tree_MapRowToCache(unsigned long nRowNo=11)  Line 2237 + 0x9 bytes    C++
	 ProfUIS290md.dll!CExtTreeGridDataProvider::_Tree_NodeGetByVisibleRowIndex(unsigned long nRowNo=12)  Line 970 + 0x16 bytes    C++
	 ProfUIS290md.dll!CExtTreeGridDataProvider::TreeNodeGetByVisibleRowIndex(unsigned long nRowNo=12)  Line 955 + 0x16 bytes    C++
	 ProfUIS290md.dll!CExtTreeGridWnd::ItemGetByVisibleRowIndex(long nRowNo=12)  Line 3073 + 0xc bytes    C++
	 ProfUIS290md.dll!CExtTreeGridWnd::OnSiwQueryItemExtentV(long nRowNo=11, int * p_nExtraSpaceBefore=0x00000000, int * p_nExtraSpaceAfter=0x00000000)  Line 5123 + 0x16 bytes    C++
	 ProfUIS290md.dll!CExtGridBaseWnd::OnSiwCalcPageMetrics(int nDirection=0)  Line 7480 + 0x1d bytes    C++
	 ProfUIS290md.dll!CExtScrollItemWnd::OnSiwGetVisibleRange()  Line 7159 + 0x18 bytes    C++
	 ProfUIS290md.dll!CExtScrollItemWnd::OnSwUpdateScrollBars()  Line 5801 + 0x1d bytes    C++
	 ProfUIS290md.dll!CExtGridBaseWnd::OnSwUpdateScrollBars()  Line 13048    C++
	 ProfUIS290md.dll!CExtTreeGridWnd::ItemInsert(_TREEITEM * hTreeItemParent=0x02cfa9a4, unsigned long nIdxInsertBefore=4294967295, unsigned long nInsertCount=1, bool bRedraw=true)  Line 3531 + 0x12 bytes    C++
	 TreeGridBug.exe!CComboProblemDlg::OnClick2()  Line 399 + 0x2c bytes    C++

Offer Har Aug 28, 2010 - 5:51 AM

Wrong thread... sorry.

Technical Support Aug 27, 2010 - 10:30 AM

Thank you for reporting this issue. Please update the source code for the following two methods:

void CExtPPVW < CExtPropertyGridCtrl > :: OnPreparePrinting_RenderCategoryName(
            CPrintInfo * pInfo,
            const CArray < CExtPropertyItem *, CExtPropertyItem * & > & arrPrintableItems,
            const CArray < INT, INT & > & arrPrintableParents,
            const INT * arrColumnWidths,
            const CArray < INT, INT & > & arrRowHeights,
            CExtGridWnd * pWndGrid,
            INT nPageIndex,
            LONG nRowNoFrom,
            LONG nRowNoTo,
            LONG nRowNo,
            CDC & dc,
            CExtPropertyCategory * pPropertyItem,
            CRect & rcName,
            __EXT_MFC_SAFE_LPCTSTR strName,
            INT nIndentExt
            )
{
            ASSERT_VALID( this );
            ASSERT( GetSafeHwnd() != NULL );
            ASSERT_VALID( pPropertyItem );
            ASSERT( LPCTSTR(strName) != NULL );
            ASSERT( 0 <= nRowNo && nRowNo < LONG(arrPrintableItems.GetSize()) );
            ASSERT( LPVOID(arrPrintableItems[nRowNo]) == LPVOID(pPropertyItem) );
            pInfo;
            nPageIndex;
            nRowNoFrom;
            nRowNoTo;
            arrPrintableItems;
            arrPrintableParents;
            arrColumnWidths;
            arrRowHeights;
            pPropertyItem;
            pWndGrid;
            nIndentExt;
            nRowNo;

// { // BLOCK: begin (test custom background with lines)
// CRect rcLines = rcCategoryName;
// rcLines.right ++;
// rcLines.bottom ++;
// HGDIOBJ hOldBrush = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(WHITE_BRUSH) );
// HGDIOBJ hOldPen = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(NULL_PEN) );
// dc.Rectangle( &rcLines );
// ::SelectObject( dc.m_hDC, hOldPen );
// ::SelectObject( dc.m_hDC, hOldBrush );
// } // BLOCK: end (test custom background with lines)

INT nNameLen = nNameLen = INT( _tcslen( LPCTSTR(strName) ) );
COLORREF clrOldText = dc.SetTextColor( RGB(0,0,0) );
INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
            CExtRichContentLayout::stat_DrawText( dc.m_hDC, strName, nNameLen, &rcName, DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_NOCLIP, 0 );
            dc.SetBkMode( nOldBkMode );
            dc.SetTextColor( clrOldText );

// { // BLOCK: begin (test custom background with lines)
// CRect rcLines = rcCategoryName;
// rcLines.right ++;
// rcLines.bottom ++;
// HGDIOBJ hOldBrush = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(NULL_BRUSH) );
// HGDIOBJ hOldPen = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(BLACK_PEN) );
// dc.Rectangle( &rcLines );
// ::SelectObject( dc.m_hDC, hOldPen );
// ::SelectObject( dc.m_hDC, hOldBrush );
// } // BLOCK: end (test custom background with lines)

            if( m_bDrawSimpleBlackOutline )
            {
                        CExtPropertyStore * pPS = PropertyStoreGet();
                        ASSERT_VALID( pPS );
                        if( LPVOID(pPropertyItem->ItemParentGet()) != LPVOID(pPS) )
                        {
                                    CExtPropertyItem * pWalkItem = pPropertyItem;
                                    INT nIndentLevel = 1;
                                    INT nWalkRowNo = INT(nRowNo);
                                    for( ; LPVOID(pWalkItem) != LPVOID(pPS); )
                                    {
                                                INT nParentWalkRowNo = arrPrintableParents[ nWalkRowNo ];
                                                nWalkRowNo = nParentWalkRowNo;
                                                if( nWalkRowNo < 0 )
                                                            break;
                                                pWalkItem = arrPrintableItems[ nWalkRowNo ];
                                                ASSERT_VALID( pWalkItem );
                                                nIndentLevel ++;
                                    }
                                    if( nIndentLevel > 1 )
                                    {
                                                HGDIOBJ hOldBrush = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(NULL_BRUSH) );
                                                HGDIOBJ hOldPen = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(BLACK_PEN) );
                                                COLORREF clrDots = RGB( 0, 0, 0 );
                                                CRect rcIndent(
                                                            rcName.left,
                                                            rcName.top,
                                                            rcName.left,
                                                            rcName.bottom
                                                            );
                                                pWalkItem = pPropertyItem;
                                                nWalkRowNo = INT(nRowNo);
                                                INT nPxIndent = rcName.left / (nIndentLevel-1);
                                                for( ; LPVOID(pWalkItem) != LPVOID(pPS); )
                                                {
                                                            ASSERT( pWalkItem != NULL );
                                                            INT nParentWalkRowNo = arrPrintableParents[ nWalkRowNo ];
                                                            if( nParentWalkRowNo >= 0 && LPVOID(arrPrintableItems[ nParentWalkRowNo ]) == LPVOID(pPS) )
                                                                        break;
                                                            rcIndent.right = rcIndent.left;
                                                            rcIndent.left -= nPxIndent;
                                                            INT nMetricH = rcIndent.Width();
                                                            INT nMetricH2 = nMetricH / 2;
                                                            INT nMetricV = rcIndent.Height();
                                                            INT nMetricV2 = min( nMetricH, nMetricV );
                                                            nMetricV2 /= 2;
                                                            bool bDrawUpperLineV = false;
                                                            if( LPVOID(pPropertyItem) == LPVOID(pWalkItem) )
                                                            {
                                                                        if( m_bDrawSimpleBlackOutlineUsingDots )
                                                                                    CExtPaintManager::stat_DrawDotLineH(
                                                                                                dc,
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.right,
                                                                                                rcIndent.top + nMetricV2,
                                                                                                clrDots
                                                                                                );
                                                                        else
                                                                        {
                                                                                    dc.MoveTo(
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top + nMetricV2
                                                                                                );
                                                                                    dc.LineTo(
                                                                                                rcIndent.right,
                                                                                                rcIndent.top + nMetricV2
                                                                                                );
                                                                        }
                                                                        bDrawUpperLineV = true;
                                                            }
                                                            CExtPropertyItem * pWalkItemNext = NULL;
                                                            if( nParentWalkRowNo >= 0 )
                                                            {
//                                                                      CExtPropertyItem * pParent = arrPrintableItems[ nParentWalkRowNo ];
                                                                        CExtPropertyItem * pParent = pWalkItem->ItemParentGet();
                                                                        ASSERT_VALID( pParent );
                                                                        INT nWalkRealSiblingIndex = pParent->ItemGetIndexOf( pWalkItem );
                                                                        ASSERT( nWalkRealSiblingIndex >= 0 );
                                                                        INT nRealSiblingCount = pParent->ItemGetCount();
                                                                        if( nWalkRealSiblingIndex < ( nRealSiblingCount - 1 ) )
                                                                                    pWalkItemNext = pParent->ItemGetAt( nWalkRealSiblingIndex + 1 );
                                                            }
                                                            if( pWalkItemNext != NULL )
                                                            {
                                                                        if( m_bDrawSimpleBlackOutlineUsingDots )
                                                                                    CExtPaintManager::stat_DrawDotLineV(
                                                                                                dc,
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top + nMetricV2,
                                                                                                rcIndent.bottom,
                                                                                                clrDots
                                                                                                );
                                                                        else
                                                                        {
                                                                                    dc.MoveTo(
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top + nMetricV2
                                                                                                );
                                                                                    dc.LineTo(
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.bottom
                                                                                                );
                                                                        }
                                                                        bDrawUpperLineV = true;
                                                            }
                                                            if( bDrawUpperLineV )
                                                            {
                                                                        if( m_bDrawSimpleBlackOutlineUsingDots )
                                                                                    CExtPaintManager::stat_DrawDotLineV(
                                                                                                dc,
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top,
                                                                                                rcIndent.top + nMetricV2,
                                                                                                clrDots
                                                                                                );
                                                                        else
                                                                        {
                                                                                    dc.MoveTo(
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top
                                                                                                );
                                                                                    dc.LineTo(
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top + nMetricV2
                                                                                                );
                                                                        }
                                                            }
                                                            nWalkRowNo = nParentWalkRowNo;
                                                            if( nWalkRowNo < 0 )
                                                                        break;
                                                            pWalkItem = arrPrintableItems[ nWalkRowNo ];
                                                            ASSERT_VALID( pWalkItem );
                                                } // for( ...
                                                ::SelectObject( dc.m_hDC, hOldPen );
                                                ::SelectObject( dc.m_hDC, hOldBrush );
                                    } // if( nIndentLevel > 1 )
                        } // if( LPVOID(pPropertyItem->ItemParentGet()) != LPVOID(pPS) )
            } // if( m_bDrawSimpleBlackOutline )
}

void CExtPPVW < CExtPropertyGridCtrl > :: OnPreparePrinting_RenderPropertyItemCaption(
            CPrintInfo * pInfo,
            const CArray < CExtPropertyItem *, CExtPropertyItem * & > & arrPrintableItems,
            const CArray < INT, INT & > & arrPrintableParents,
            const INT * arrColumnWidths,
            const CArray < INT, INT & > & arrRowHeights,
            CExtGridWnd * pWndGrid,
            INT nPageIndex,
            LONG nRowNoFrom,
            LONG nRowNoTo,
            LONG nRowNo,
            CDC & dc,
            CExtPropertyItem * pPropertyItem,
            CRect & rcName,
            __EXT_MFC_SAFE_LPCTSTR strName,
            INT nIndentExt
            )
{
            ASSERT_VALID( this );
            ASSERT( GetSafeHwnd() != NULL );
            ASSERT_VALID( pPropertyItem );
            ASSERT( LPCTSTR(strName) != NULL );
            ASSERT( 0 <= nRowNo && nRowNo < LONG(arrPrintableItems.GetSize()) );
            ASSERT( LPVOID(arrPrintableItems[nRowNo]) == LPVOID(pPropertyItem) );
            pInfo;
            nPageIndex;
            nRowNoFrom;
            nRowNoTo;
            arrPrintableItems;
            arrPrintableParents;
            arrColumnWidths;
            arrRowHeights;
            pPropertyItem;
            pWndGrid;
            nIndentExt;
            nRowNo;

            if( m_bDrawSimpleWhiteBackground )
            {
                        CRect rcLines = rcName;
                        rcLines.right ++;
                        rcLines.bottom ++;
                        HGDIOBJ hOldBrush = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(WHITE_BRUSH) );
                        HGDIOBJ hOldPen = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(NULL_PEN) );
                        dc.Rectangle( &rcLines );
                        ::SelectObject( dc.m_hDC, hOldPen );
                        ::SelectObject( dc.m_hDC, hOldBrush );
            } // if( m_bDrawSimpleWhiteBackground )
INT nNameLen = nNameLen = INT( _tcslen( LPCTSTR(strName) ) );
COLORREF clrOldText = dc.SetTextColor( RGB(0,0,0) );
INT nOldBkMode = dc.SetBkMode( TRANSPARENT );
            CExtRichContentLayout::stat_DrawText( dc.m_hDC, strName, nNameLen, &rcName, DT_SINGLELINE|DT_LEFT|DT_VCENTER|DT_NOCLIP, 0 );
            dc.SetBkMode( nOldBkMode );
            dc.SetTextColor( clrOldText );
            if( m_bDrawSimpleBlackBorders )
            {
                        CRect rcLines = rcName;
                        rcLines.left = 0;
                        rcLines.right ++;
                        rcLines.bottom ++;
                        HGDIOBJ hOldBrush = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(NULL_BRUSH) );
                        HGDIOBJ hOldPen = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(BLACK_PEN) );
                        dc.Rectangle( &rcLines );
                        ::SelectObject( dc.m_hDC, hOldPen );
                        ::SelectObject( dc.m_hDC, hOldBrush );
            } // if( m_bDrawSimpleBlackBorders )

            if( m_bDrawSimpleBlackOutline )
            {
                        CExtPropertyStore * pPS = PropertyStoreGet();
                        ASSERT_VALID( pPS );
                        if( LPVOID(pPropertyItem->ItemParentGet()) != LPVOID(pPS) )
                        {
                                    CExtPropertyItem * pWalkItem = pPropertyItem;
                                    INT nIndentLevel = 1;
                                    INT nWalkRowNo = INT(nRowNo);
                                    for( ; LPVOID(pWalkItem) != LPVOID(pPS); )
                                    {
                                                INT nParentWalkRowNo = arrPrintableParents[ nWalkRowNo ];
                                                nWalkRowNo = nParentWalkRowNo;
                                                if( nWalkRowNo < 0 )
                                                            break;
                                                pWalkItem = arrPrintableItems[ nWalkRowNo ];
                                                ASSERT_VALID( pWalkItem );
                                                nIndentLevel ++;
                                    }
                                    if( nIndentLevel > 1 )
                                    {
                                                HGDIOBJ hOldBrush = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(NULL_BRUSH) );
                                                HGDIOBJ hOldPen = ::SelectObject( dc.m_hDC, (HGDIOBJ)::GetStockObject(BLACK_PEN) );
                                                COLORREF clrDots = RGB( 0, 0, 0 );
                                                CRect rcIndent(
                                                            rcName.left,
                                                            rcName.top,
                                                            rcName.left,
                                                            rcName.bottom
                                                            );
                                                pWalkItem = pPropertyItem;
                                                nWalkRowNo = INT(nRowNo);
                                                INT nPxIndent = rcName.left / (nIndentLevel-1);
                                                for( ; LPVOID(pWalkItem) != LPVOID(pPS); )
                                                {
                                                            ASSERT( pWalkItem != NULL );
                                                            INT nParentWalkRowNo = arrPrintableParents[ nWalkRowNo ];
                                                            if( nParentWalkRowNo >= 0 && LPVOID(arrPrintableItems[ nParentWalkRowNo ]) == LPVOID(pPS) )
                                                                        break;
                                                            rcIndent.right = rcIndent.left;
                                                            rcIndent.left -= nPxIndent;
                                                            INT nMetricH = rcIndent.Width();
                                                            INT nMetricH2 = nMetricH / 2;
                                                            INT nMetricV = rcIndent.Height();
                                                            INT nMetricV2 = min( nMetricH, nMetricV );
                                                            nMetricV2 /= 2;
                                                            bool bDrawUpperLineV = false;
                                                            if( LPVOID(pPropertyItem) == LPVOID(pWalkItem) )
                                                            {
                                                                        if( m_bDrawSimpleBlackOutlineUsingDots )
                                                                                    CExtPaintManager::stat_DrawDotLineH(
                                                                                                dc,
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.right,
                                                                                                rcIndent.top + nMetricV2,
                                                                                                clrDots
                                                                                                );
                                                                        else
                                                                        {
                                                                                    dc.MoveTo(
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top + nMetricV2
                                                                                                );
                                                                                    dc.LineTo(
                                                                                                rcIndent.right,
                                                                                                rcIndent.top + nMetricV2
                                                                                                );
                                                                        }
                                                                        bDrawUpperLineV = true;
                                                            }
                                                            CExtPropertyItem * pWalkItemNext = NULL;
                                                            if( nParentWalkRowNo >= 0 )
                                                            {
//                                                                      CExtPropertyItem * pParent = arrPrintableItems[ nParentWalkRowNo ];
                                                                        CExtPropertyItem * pParent = pWalkItem->ItemParentGet();
                                                                        ASSERT_VALID( pParent );
                                                                        INT nWalkRealSiblingIndex = pParent->ItemGetIndexOf( pWalkItem );
                                                                        ASSERT( nWalkRealSiblingIndex >= 0 );
                                                                        INT nRealSiblingCount = pParent->ItemGetCount();
                                                                        if( nWalkRealSiblingIndex < ( nRealSiblingCount - 1 ) )
                                                                                    pWalkItemNext = pParent->ItemGetAt( nWalkRealSiblingIndex + 1 );
                                                            }
                                                            if( pWalkItemNext != NULL )
                                                            {
                                                                        if( m_bDrawSimpleBlackOutlineUsingDots )
                                                                                    CExtPaintManager::stat_DrawDotLineV(
                                                                                                dc,
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top + nMetricV2,
                                                                                                rcIndent.bottom,
                                                                                                clrDots
                                                                                                );
                                                                        else
                                                                        {
                                                                                    dc.MoveTo(
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top + nMetricV2
                                                                                                );
                                                                                    dc.LineTo(
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.bottom
                                                                                                );
                                                                        }
                                                                        bDrawUpperLineV = true;
                                                            }
                                                            if( bDrawUpperLineV )
                                                            {
                                                                        if( m_bDrawSimpleBlackOutlineUsingDots )
                                                                                    CExtPaintManager::stat_DrawDotLineV(
                                                                                                dc,
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top,
                                                                                                rcIndent.top + nMetricV2,
                                                                                                clrDots
                                                                                                );
                                                                        else
                                                                        {
                                                                                    dc.MoveTo(
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top
                                                                                                );
                                                                                    dc.LineTo(
                                                                                                rcIndent.left + nMetricH2,
                                                                                                rcIndent.top + nMetricV2
                                                                                                );
                                                                        }
                                                            }
                                                            nWalkRowNo = nParentWalkRowNo;
                                                            if( nWalkRowNo < 0 )
                                                                        break;
                                                            pWalkItem = arrPrintableItems[ nWalkRowNo ];
                                                            ASSERT_VALID( pWalkItem );
                                                } // for( ...
                                                ::SelectObject( dc.m_hDC, hOldPen );
                                                ::SelectObject( dc.m_hDC, hOldBrush );
                                    } // if( nIndentLevel > 1 )
                        } // if( LPVOID(pPropertyItem->ItemParentGet()) != LPVOID(pPS) )
            } // if( m_bDrawSimpleBlackOutline )
}