HBRUSH CColorStatic::CtlColor(CDC* pDC, UINT nCtlColor)
{
pDC->SetTextColor(m_color);
pDC->SetBkColor(GetSysColor(COLOR_3DFACE));
return m_brush;
}
CColorStatic::CColorStatic()
: m_brush(GetSysColor(COLOR_3DFACE))
{
m_color = RGB(0,0,0);
}
とする。
m_lay.SetType(GetDlgItem(IDOK)); // 水平、垂直に動く場合
// 水平だけ動く場合
m_lay.SetType(GetDlgItem(IDOK),CLayoutManager::FixSize,CLayoutManager::Default);
m_lay.Reset();
以上
void CComboRight::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
CRect rc(lpDrawItemStruct->rcItem);
COLORREF pre = pDC->GetBkColor();
pDC->FillSolidRect(&rc,GetSysColor(COLOR_WINDOW));
pDC->SetBkColor(pre);
rc.InflateRect(-2, -2);
int i = lpDrawItemStruct->itemID;
CString s;
if (i < 0) GetWindowText(s);
else GetLBText(i,s);
pDC->DrawText(s,rc,DT_RIGHT);
if (lpDrawItemStruct->itemAction & ODA_FOCUS)
pDC->DrawFocusRect(&lpDrawItemStruct->rcItem);
}