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 » Can I change fg color & bg color of CExtPropertyGridTipBar? Collapse All
Subject Author Date
Do Park Nov 14, 2007 - 3:29 PM

Right now, I am using the theme "Office2007 R3 Obsidian" at my application.

But under this theme, CExtPropertyGridTipBar is not readable because its text is black and its background is very dark gray..

Can you give me some tips to change color of either text or background in CExtPropertyGridTipBar ?

Thanks.

Do Park

Technical Support Nov 16, 2007 - 9:39 AM

We changed the text color to white in the CExtPropertyGridTipBar control bar in the Office 2007 Black theme . Please update the following method

void CExtPropertyGridTipBar::DoPaint( CDC * pDC )
{
	ASSERT_VALID( this );
	ASSERT_VALID( pDC );
CExtPaintManager * pPM = PmBridge_GetPM();
CRect rcClient;
	GetClientRect( &rcClient );
CExtMemoryDC dc( pDC, &rcClient );
	if(		(! pPM->GetCb2DbTransparentMode( this ) )
		||	(! pPM->PaintDockerBkgnd(
				true,
				dc,
				this
				)
			)
		)
		dc.FillSolidRect(
			&rcClient,
			pPM->GetColor(
				CExtPaintManager::CLR_3DFACE_OUT
				)
			);
CRect rcDraw = rcClient;
	rcDraw.top += m_nSeparatorHeight;
	if(		rcDraw.left >= rcDraw.right
		||	rcDraw.top >= rcDraw.bottom
		)
		return;
	pPM->PaintResizableBarChildNcAreaRect(
		dc,
		rcDraw,
		this
		);
	rcDraw.DeflateRect( 5, 3 );
	if(		rcDraw.left >= rcDraw.right
		||	rcDraw.top >= rcDraw.bottom
		)
		return;
CExtSafeString str = PropertyNameGet();
	if( str.IsEmpty() )
		return;
int nOldBkMode = dc.SetBkMode( TRANSPARENT );

COLORREF clrText =
		pPM->QueryObjectTextColor(
			dc,
			true,
			false,
			false,
			false,
			(CObject*)this
			);
	if( clrText == COLORREF(-1L) )
		clrText =
			pPM->GetColor(
				COLOR_BTNTEXT,
				(CObject*)this
				);

COLORREF clrOldTextColor =
		dc.SetTextColor( clrText );
CFont * pOldFont =
		dc.SelectObject(
			&pPM->m_FontBold
			);
CRect rcMeasure( 0, 0, 0, 0 );
	dc.DrawText(
		LPCTSTR(str),
		str.GetLength(),
		&rcMeasure,
		DT_SINGLELINE|DT_LEFT|DT_TOP|DT_END_ELLIPSIS|DT_CALCRECT
		);
	dc.DrawText(
		LPCTSTR(str),
		str.GetLength(),
		&rcDraw,
		DT_SINGLELINE|DT_LEFT|DT_TOP|DT_END_ELLIPSIS
		);
	str = PropertyDescriptionGet();
	if( ! str.IsEmpty() )
	{
		rcDraw.top += rcMeasure.Height() + 3;
		if(		rcDraw.left < rcDraw.right
			&&	rcDraw.top < rcDraw.bottom
			)
		{
			dc.SelectObject( 
				&pPM->m_FontNormal
				);
			dc.DrawText(
				LPCTSTR(str),
				str.GetLength(),
				&rcDraw,
				DT_LEFT|DT_TOP|DT_WORDBREAK
				);
		}
	} // if( ! str.IsEmpty() )
	dc.SelectObject( pOldFont );
	dc.SetTextColor( clrOldTextColor );
	dc.SetBkMode( nOldBkMode );
}


Do Park Nov 16, 2007 - 11:13 AM

This code is working perfect.

Thanks.

Do Park