#include "StdAfx.h" #include "T2DlgItemTButton.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif T2DlgItemTButton::T2DlgItemTButton(T2TowerDoc* inDoc, T2ImageObj* inImageObj, CPalette* inPalette) : T2DlgItemButtonBase(inDoc, inImageObj, inPalette) { } /*virtual*/ BOOL T2DlgItemTButton::OnT2DlgItemEraseBkgnd(CDC* pDC) { #pragma var_order(rect, save, text) CString text; GetWindowText(text); if (text == "NULL") return true; CRect rect; GetClientRect(rect); DrawButtonBase(pDC, rect, GetPattern() == 100); int save = pDC->SaveDC(); pDC->SelectPalette(mPalette, false); pDC->RealizePalette(); pDC->SelectObject(mFont); pDC->SetBkMode(TRANSPARENT); if (!IsWindowEnabled()) pDC->SetTextColor(PALETTERGB(179, 179, 179)); else if (GetPattern() == 100) rect.OffsetRect(1, 1); else pDC->SetTextColor(RGB(0, 0, 0)); pDC->DrawText(text, -1, rect, DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOPREFIX); pDC->RestoreDC(save); return true; }