Пример #1
0
int CRedlineObject::DrawObject(HDC hDC, LPRECT lpRect, bool bSelected)
{
	int iSavedDC		= ::SaveDC(hDC);
	long  lOldColor		= ::GetTextColor(hDC);
	long  lOldBkColor	= ::GetBkColor(hDC);
	long lNewColor		=  SetNewTextColor(hDC, bSelected);
	
	
	HFONT hSelectedFont = MakeFontBold(m_pFont->GetFontHandle(), IsBold());
	HFONT hOldFont		= (HFONT)::SelectObject(hDC, hSelectedFont);
		
	long lTextWidth  = GetTextRectWidth(hDC, m_sText);

	int nOldBKMode = TRANSPARENT;

	if (m_pFont->GetTextBackColor() != -1)
	{
		nOldBKMode = ::GetBkMode(hDC);
		::SetBkMode(hDC, OPAQUE);
	}

	::DrawText(hDC, m_sText, (x64_int_cast)m_sText.length(), lpRect, DT_NOPREFIX | DT_LEFT | DT_VCENTER);

	if (m_pFont->GetTextBackColor() != -1)
	{
		::SetBkMode(hDC, nOldBKMode);
	}

	DrawUnderline(hDC, lpRect, lTextWidth, lNewColor, m_pFont->IsDoubleUnderline(), bSelected);
	
	::SelectObject(hDC, hOldFont);
	::SetTextColor(hDC, lOldColor);
	::SetBkColor(hDC, lOldBkColor);
	
	if(hSelectedFont)
		::DeleteObject(hSelectedFont);
	
	::RestoreDC(hDC, iSavedDC);

	return lTextWidth;
}
Пример #2
0
void CLogListBox::Init()
{
	NormalFont = GetFont();
	UnderlineFont =  MakeFontUnderLine(NormalFont);
	BoldFont = MakeFontBold(NormalFont);
}