|
#include "StdAfx.h"
|
#include "General_Draw.h"
|
#include "Server_MemDC.h"
|
|
CGeneralDraw::CGeneralDraw(void)
|
{
|
}
|
|
CGeneralDraw::~CGeneralDraw(void)
|
{
|
}
|
|
void CGeneralDraw::DrawPitureControl(CUIPictureControl &pPicture)
|
{
|
if(pPicture.isVaildDC() == FALSE)
|
return;
|
|
CBrush brush,backbrush,brushDisable;
|
HFONT font,pOldFont;
|
HDC hDC;
|
CRect rect = pPicture.m_rect;
|
|
// create font
|
font = ::CreateFont(pPicture.m_nFontsize, 0, 0, 0, pPicture.m_nFontType, 0, 0, 0,
|
DEFAULT_CHARSET, OUT_CHARACTER_PRECIS, CLIP_CHARACTER_PRECIS,
|
ANTIALIASED_QUALITY, DEFAULT_PITCH|FF_DECORATIVE, pPicture.m_strFont);
|
|
CControlMemDC memDC(pPicture.m_pDC, &rect);
|
hDC = memDC.GetSafeHdc();
|
|
pOldFont = (HFONT) ::SelectObject(hDC, font);
|
if(::GetTextColor(hDC) != pPicture.m_colText) ::SetTextColor(hDC, pPicture.m_colText);
|
::SetBkMode(hDC, TRANSPARENT);
|
|
brushDisable.CreateSolidBrush(RGB(128,128,128));
|
brush.CreateSolidBrush(pPicture.m_colInner);
|
backbrush.CreateSolidBrush(pPicture.m_colBack);
|
::FillRect(hDC,&rect,(HBRUSH)backbrush);
|
rect.left += pPicture.m_nInnerOffset;
|
rect.right -= pPicture.m_nInnerOffset;
|
rect.top += pPicture.m_nInnerOffset;
|
rect.bottom -= pPicture.m_nInnerOffset;
|
|
if(pPicture.m_bEnable == TRUE)
|
{
|
::FillRect(hDC,&rect,(HBRUSH)brush);
|
rect.left += pPicture.m_FontOffset.x;
|
rect.top += pPicture.m_FontOffset.y;
|
::DrawText(hDC, pPicture.m_strData, pPicture.m_strData.GetLength(), &rect, pPicture.m_nAlign);
|
}
|
else
|
{
|
::FillRect(hDC,&rect,(HBRUSH)brushDisable);
|
}
|
|
brush.DeleteObject();
|
backbrush.DeleteObject();
|
brushDisable.DeleteObject();
|
::DeleteObject(::SelectObject(hDC, (HFONT)pOldFont));
|
::DeleteObject(font);
|
}
|