コード例 #1
0
ファイル: RichElement.cpp プロジェクト: MXControl/RoboMX
void CRichElement::PrePaint(CDC* pDC, BOOL bHover)
{
	
	if(m_pDocument->m_fntNormal.m_hObject == NULL) m_pDocument->CreateFonts();
	
	CFont* pFont = &m_pDocument->m_fntNormal;
	
	switch (m_nType){

	case retText:
	case retName:
		if(m_nFlags & retfColor){

			pDC->SetTextColor(m_cColor);
			pDC->SetBkColor(m_cBgColor);
		}
		else
			pDC->SetTextColor(m_pDocument->m_crText);
		pFont = &m_pDocument->m_fntNormal;
		break;
	case retLink:
		if(m_nFlags & retfColor)
			pDC->SetTextColor(m_cColor);
		else
			pDC->SetTextColor(bHover ? m_pDocument->m_crHover : m_pDocument->m_crLink);
		pFont = &m_pDocument->m_fntUnder;
		break;
	case retBitmap:
		PrePaintBitmap(pDC);
		pFont = NULL;
		break;
	default:
		pFont = NULL;
		break;
	}
	
	if(m_nFlags & retfBold){

		if(m_nFlags & retfUnderline) pFont = &m_pDocument->m_fntBoldUnder;
		else pFont = &m_pDocument->m_fntBold;
	}
	else if(m_nFlags & retfItalic){

		pFont = &m_pDocument->m_fntItalic;
	}
	else if(m_nFlags & retfUnderline){

		pFont = &m_pDocument->m_fntUnder;
	}
	else if(m_nFlags & retfHeading){

		pFont = &m_pDocument->m_fntHeading;
		pDC->SetTextColor(m_pDocument->m_crHeading);
	}
	
	if(pFont) pDC->SelectObject(pFont);
}
コード例 #2
0
ファイル: RichElement.cpp プロジェクト: GetEnvy/Envy
void CRichElement::PrePaint(CDC* pDC, BOOL bHover)
{
	ASSERT( m_pDocument->m_fntNormal.m_hObject != NULL );

	CFont* pFont = &m_pDocument->m_fntNormal;

	switch ( m_nType )
	{
	case retText:
		if ( m_nFlags & retfColor )
			pDC->SetTextColor( m_cColor );
		else
			pDC->SetTextColor( m_pDocument->m_crText );
		pFont = &m_pDocument->m_fntNormal;
		break;
	case retLink:
		if ( m_nFlags & retfColor )
			pDC->SetTextColor( m_cColor );
		else
			pDC->SetTextColor( bHover ? m_pDocument->m_crHover : m_pDocument->m_crLink );
		pFont = &m_pDocument->m_fntUnder;
		break;
	case retBitmap:
		PrePaintBitmap( pDC );
		pFont = NULL;
		break;
	case retIcon:
		PrePaintIcon( pDC );
		pFont = NULL;
		break;
	case retEmoticon:
		_stscanf( m_sText, L"%i", &m_nImageIndex );			// ToDo:
		m_hImage = NULL;
		pFont = NULL;
		break;
	case retCmdIcon:
		if ( UINT nID = CoolInterface.NameToID( m_sText ) )
		{
			m_nImageIndex = CoolInterface.ImageForID( nID );	// ToDo:
			m_hImage = NULL;
		}
		break;
	default:
		pFont = NULL;
		break;
	}

	if ( m_nFlags & retfBold )
	{
		pFont = ( m_nFlags & retfUnderline ) ? &m_pDocument->m_fntBoldUnder : &m_pDocument->m_fntBold;
	}
	else if ( m_nFlags & retfItalic )
	{
		pFont = &m_pDocument->m_fntItalic;
	}
	else if ( m_nFlags & retfUnderline )
	{
		pFont = &m_pDocument->m_fntUnder;
	}
	else if ( m_nFlags & retfHeading )
	{
		pFont = &m_pDocument->m_fntHeading;
		pDC->SetTextColor( m_pDocument->m_crHeading );
	}

	if ( pFont ) pDC->SelectObject( pFont );
}