本文整理汇总了C++中CBrush::CreateSysColorBrush方法的典型用法代码示例。如果您正苦于以下问题:C++ CBrush::CreateSysColorBrush方法的具体用法?C++ CBrush::CreateSysColorBrush怎么用?C++ CBrush::CreateSysColorBrush使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBrush
的用法示例。
在下文中一共展示了CBrush::CreateSysColorBrush方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDrawItem
void CFavoriteOrganizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if(nIDCtl != IDC_LIST2) return;
int nItem = lpDrawItemStruct->itemID;
CRect rcItem = lpDrawItemStruct->rcItem;
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
if(!!m_list.GetItemState(nItem, LVIS_SELECTED))
{
FillRect(pDC->m_hDC, rcItem, CBrush(0xf1dacc));
FrameRect(pDC->m_hDC, rcItem, CBrush(0xc56a31));
}
else
{
CBrush b;
b.CreateSysColorBrush(COLOR_WINDOW);
FillRect(pDC->m_hDC, rcItem, b);
}
CString str = m_list.GetItemText(nItem, 0);
pDC->SetTextColor(0);
pDC->TextOut(rcItem.left+3, (rcItem.top+rcItem.bottom - pDC->GetTextExtent(str).cy)/2, str);
}
示例2: OnDrawItem
void CFavoriteOrganizeDlg::OnDrawItem(int nIDCtl, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if (nIDCtl != IDC_LIST2) {
return;
}
int nItem = lpDrawItemStruct->itemID;
CRect rcItem = lpDrawItemStruct->rcItem;
CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
if (!!m_list.GetItemState(nItem, LVIS_SELECTED)) {
CBrush b1, b2;
b1.CreateSolidBrush(0xf1dacc);
pDC->FillRect(rcItem, &b1);
b2.CreateSolidBrush(0xc56a31);
pDC->FrameRect(rcItem, &b2);
} else {
CBrush b;
b.CreateSysColorBrush(COLOR_WINDOW);
pDC->FillRect(rcItem, &b);
}
CString str;
pDC->SetTextColor(0);
str = m_list.GetItemText(nItem, 0);
pDC->TextOut(rcItem.left + 3, (rcItem.top + rcItem.bottom - pDC->GetTextExtent(str).cy) / 2, str);
str = m_list.GetItemText(nItem, 1);
if (!str.IsEmpty()) {
pDC->TextOut(rcItem.right - pDC->GetTextExtent(str).cx - 3, (rcItem.top + rcItem.bottom - pDC->GetTextExtent(str).cy) / 2, str);
}
}
示例3: DrawFolder
void CGuiFolder::DrawFolder(CFolderBar* cfb,Style m_Style)
{
CRect rc=cfb->m_rect;
CBrush cb;
CClientDC pDC(this);
cb.CreateSysColorBrush(COLOR_BTNFACE);
rc.top+=1;
rc.right-=1;
pDC.FillRect(&rc,&cb);
if (m_typel!=mOutlook)
{
rc.right-=30;
}
if (m_Style == mNormal)
{
pDC.Draw3dRect(rc, GuiDrawLayer::GetRGBColorBTNHigh(),GuiDrawLayer::GetRGBColorShadow());
rc.DeflateRect(1,1);
pDC.Draw3dRect(rc, GuiDrawLayer::GetRGBColorFace(),GuiDrawLayer::GetRGBColorShadow());
}
else if (m_Style == mFlat)
pDC.Draw3dRect(rc, GuiDrawLayer::GetRGBColorBTNHigh(),GuiDrawLayer::GetRGBColorShadow());
else if (m_Style == mPush)
pDC.Draw3dRect(rc, GuiDrawLayer::GetRGBColorShadow(),GuiDrawLayer::GetRGBColorBTNHigh());
int OldMode=pDC.SetBkMode(TRANSPARENT);
cfont = pDC.SelectObject(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
CString m_cadBreak=cfb->m_lpMsg;
int cont=m_cadBreak.GetLength();
CSize coor=pDC.GetTextExtent(m_cadBreak,m_cadBreak.GetLength());
if ( coor.cx > rc.Width())
{
rc.left+=1;
while(cont > 1 )
{
CString m_scadtemp=m_cadBreak+"...";
CSize coor=pDC.GetTextExtent(m_scadtemp,m_scadtemp.GetLength());
if(coor.cx > rc.Width())
m_cadBreak=m_cadBreak.Left(m_cadBreak.GetLength()-1);
else
break;
cont--;
}
m_cadBreak+=_T("...");
rc.right+=3;
pDC.DrawText(m_cadBreak,rc,DT_SINGLELINE|DT_LEFT|DT_VCENTER);
}
else
{
if (m_typel!=mOutlook)
pDC.DrawText(cfb->m_lpMsg,rc,DT_SINGLELINE|DT_LEFT|DT_VCENTER);
else
pDC.DrawText(cfb->m_lpMsg,rc,DT_WORDBREAK|DT_SINGLELINE|DT_CENTER|DT_VCENTER);
}
pDC.SetBkColor(OldMode);
// Modified By SunZhenyu
pDC.SelectObject(cfont);
}
示例4: OnPaint
void GuiCapOutBar::OnPaint()
{
CPaintDC dc(this);
CRect rcClient;
GetClientRect(&rcClient);
CBrush cb;
cb.CreateSysColorBrush(GuiDrawLayer::GetRGBColorShadow());
dc.FillRect(rcClient,&cb);
}
示例5: DrawOrange
void CGuiCheckBox::DrawOrange(CDC* pDC, CRect m_rcTemp)
{
if (m_bSelected== TRUE)
{
for (int i = 0; i < 2; i++)
{
COLORREF m_Over = RGB(255, 193+ (i + 10), 111+ (i + 10));
pDC->Draw3dRect(m_rcTemp, m_Over, m_Over);
m_rcTemp.DeflateRect(1, 1);
}
m_rcTemp.InflateRect(2, 2);
pDC->SetPixel(m_rcTemp.left + 1, m_rcTemp.top + 2,::GetSysColor(COLOR_3DHIGHLIGHT));
pDC->SetPixel(m_rcTemp.left + 1, m_rcTemp.top + 3, RGB(255, 220, 185));
pDC->SetPixel(m_rcTemp.left + 1, m_rcTemp.top + 4, RGB(255, 220, 185));
pDC->SetPixel(m_rcTemp.left + 1, m_rcTemp.top + 5, RGB(255, 220, 185));
pDC->SetPixel(m_rcTemp.left + 1, m_rcTemp.top + 6, RGB(255, 220, 185));
pDC->SetPixel(m_rcTemp.left + 2, m_rcTemp.top, RGB(255, 220, 185));
pDC->SetPixel(m_rcTemp.left + 3, m_rcTemp.top, RGB(255, 220, 185));
pDC->SetPixel(m_rcTemp.left + 4, m_rcTemp.top, RGB(255, 220, 185));
pDC->SetPixel(m_rcTemp.left + 5, m_rcTemp.top, RGB(255, 220, 185));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top, RGB(254, 225, 158));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top + 1, RGB(255, 255, 255));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top + 2, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top + 3, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top + 4, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top + 5, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top + 6, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top + 7, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top + 8, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top + 9, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top, RGB(254, 255, 255));
pDC->SetPixel(m_rcTemp.left + 1, m_rcTemp.top, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left + 2, m_rcTemp.top, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left + 3, m_rcTemp.top, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left + 4, m_rcTemp.top, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left + 5, m_rcTemp.top, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left + 6, m_rcTemp.top, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left + 7, m_rcTemp.top, RGB(255, 243, 217));
pDC->SetPixel(m_rcTemp.left, m_rcTemp.top + 1, RGB(254, 255, 255));
pDC->SetPixel(m_rcTemp.left + 1, m_rcTemp.top + 1, RGB(254, 220, 139));
pDC->SetPixel(m_rcTemp.left + 2, m_rcTemp.top + 1, RGB(254, 220, 139));
pDC->SetPixel(m_rcTemp.left + 3, m_rcTemp.top + 1, RGB(254, 220, 139));
pDC->SetPixel(m_rcTemp.left + 4, m_rcTemp.top + 1, RGB(254, 220, 139));
pDC->SetPixel(m_rcTemp.left + 5, m_rcTemp.top + 1, RGB(254, 220, 139));
pDC->SetPixel(m_rcTemp.left + 6, m_rcTemp.top + 1, RGB(254, 220, 139));
pDC->SetPixel(m_rcTemp.left + 7, m_rcTemp.top + 1, RGB(254, 220, 139));
}
else
{
CBrush cbSelec;
cbSelec.CreateSysColorBrush(COLOR_3DHILIGHT);
pDC->FillRect(m_rcTemp, &cbSelec);
}
}
示例6: OnEraseBkgnd
//****************************************************************************
BOOL CGuiTabWnd::OnEraseBkgnd(CDC* pDC)
{
// TODO: Add your message handler code here and/or call default
if (m_Numtabs == 0)
{
CBrush cbr;
cbr.CreateSysColorBrush(COLOR_BTNFACE);
CRect m_rect;
GetClientRect(m_rect);
pDC->FillRect(m_rect,&cbr);
}
return TRUE;
}
示例7: OnEraseBkgnd
//****************************************************************************
BOOL CContainer::OnEraseBkgnd(HDC hDC)
{
// TODO: Add your message handler code here and/or call default
CGDI pDC(hDC);
if (m_Numtabs == 0)
{
CBrush cbr;
cbr.CreateSysColorBrush(COLOR_BTNFACE);
CRect m_rect;
GetClientRect(m_rect);
pDC.FillRect(m_rect,&cbr);
cbr.DeleteObject();
}
return TRUE;
}
示例8: OnEraseBkgnd
/**
* WM_ERASEBKGND handler. Draws background like button background.
*
* @param pDC: DC to draw background into
* @return TRUE to tell we actually erased the background.
* @exception -
* @see
*/
BOOL CWatchWindow::OnEraseBkgnd (CDC *pDC)
{
CBrush brush;
CRect geometry;
// Create the button face system brush, get our client area
// geometry and fill it with this brush.
///////////////////////////////////////////////////////////
if (!brush.CreateSysColorBrush (COLOR_BTNFACE))
return (SECControlBar::OnEraseBkgnd (pDC));
GetClientRect (&geometry);
pDC->FillRect (&geometry, &brush);
return (TRUE);
}
示例9: DrawLabel
void CIVInfoLabel::DrawLabel(CDC & dcTarget)
{
CRect rc;
GetClientRect (&rc);
CDC dc;
dc.CreateCompatibleDC (&dcTarget);
CBitmap bmp;
bmp.CreateCompatibleBitmap (&dcTarget, rc.Width(), rc.Height());
dc.SelectObject (&bmp);
CBrush brush;
brush.CreateSysColorBrush (COLOR_3DFACE);
dc.SelectObject (&brush);
dc.PatBlt (0,0, rc.Width(), rc.Height(), PATCOPY);
CFont font;
font.CreateStockObject (DEFAULT_GUI_FONT);
dc.SelectObject (&font);
dc.SetBkColor ( GetSysColor (COLOR_3DFACE));
dc.SetTextColor ( GetSysColor (COLOR_WINDOWTEXT));
CRect rcCalc = rc;
LPTSTR szStr = (LPTSTR) (LPCTSTR) m_strText;
DrawTextEx (dc, szStr, -1, &rcCalc, DT_CALCRECT | DT_CENTER | DT_WORDBREAK, NULL);
int nOffset = rcCalc.Height() < rc.Height()
? ( rc.Height() - rcCalc.Height() ) / 2 : 0;
rcCalc = rc;
rcCalc.top += nOffset;
DrawTextEx (dc, szStr, -1, &rcCalc, DT_CENTER | DT_WORDBREAK, NULL);
dcTarget.BitBlt(rc.left,rc.top,rc.Width(),rc.Height(),&dc,0,0,SRCCOPY);
}
示例10: Drawtabs
void CGuiTabWnd::Drawtabs(CDC* dc)
{
CPen light(PS_SOLID,1,GetSysColor(COLOR_BTNHIGHLIGHT));
CPen Dark(PS_SOLID,1,GetSysColor(COLOR_BTNSHADOW));
CPen Black(PS_SOLID,1,GetSysColor(BLACK_PEN));
CRect rectText;
CFont* m_fontOld=dc->SelectObject(&m_cfont);
for (int iCont=0; iCont< m_Numtabs;iCont++)
{
CGuiTab* ct=(CGuiTab*) m_pArray[iCont];
CPen* oldPen= dc->SelectObject(&light);
//si es la carpeta seleccionada, se debe
//eliminar las lineas oscuras de encima
if (iCont ==m_iSelectTab)
{
CBrush cbr;
CRect m_rectTabAux=ct->rect;
m_rectTabAux.DeflateRect(1,1);
m_rectTabAux.top-=4;
m_rectTabAux.bottom=m_rectTabAux.top+4;
cbr.CreateSysColorBrush(COLOR_BTNFACE);
dc->FillRect(ct->rect,&cbr);
dc->MoveTo(ct->rect.left,ct->rect.top-3);
dc->LineTo(ct->rect.left,ct->rect.bottom-1);
dc->FillRect(m_rectTabAux,&cbr);
dc->SelectStockObject(BLACK_PEN);
dc->MoveTo(ct->rect.left,ct->rect.bottom-1);
dc->LineTo(ct->rect.right,ct->rect.bottom-1);
//linea derecha observe que se pinta dos veces para
//dar el efecto de redondeada en la puntas
dc->SelectStockObject(BLACK_PEN);
dc->MoveTo(ct->rect.right-1,ct->rect.top-1);
dc->LineTo(ct->rect.right-1,ct->rect.bottom-1);
}
else
{
if ((iCont+1) != m_iSelectTab)
{
dc->SelectObject(&Dark);
dc->MoveTo(ct->rect.right-1,ct->rect.top+2);
dc->LineTo(ct->rect.right-1,ct->rect.bottom-2);
}
}
//se dibuja el icono
int nMode = dc->SetBkMode(TRANSPARENT);
CSize m_sChar=dc->GetTextExtent(ct->lpMsg,strlen(ct->lpMsg));
if (m_sizeImag.cx+m_sChar.cx < ct->rect.Width()-8)
{
Image.Draw(dc,ct->uIcon,CPoint(ct->rect.left+2,ct->rect.top+2),ILD_TRANSPARENT);
rectText=ct->rect;
rectText.left+=m_sizeImag.cx+8;
rectText.right-=2;
dc->DrawText(ct->lpMsg,rectText,DT_SINGLELINE|DT_LEFT|DT_VCENTER);
CToolTip.SetToolRect(this,iCont+1,CRect(0,0,0,0));
}
else
{
//verificamos si se puede poner algun texto o
//por lo memos el icono
if (m_sizeImag.cx < ct->rect.Width())
{
Image.Draw(dc,ct->uIcon,CPoint(ct->rect.left+2,ct->rect.top+2),ILD_TRANSPARENT);
rectText=ct->rect;
rectText.left+=m_sizeImag.cx+8;
rectText.right-=5;
CString m_cadBreak=ct->lpMsg;
int c=0;
int cont=m_cadBreak.GetLength();
while(cont > 1 )
{
CString m_scadtemp=m_cadBreak+"...";
CSize coor=dc->GetTextExtent(m_scadtemp,m_scadtemp.GetLength());
if(coor.cx > rectText.Width())
m_cadBreak=m_cadBreak.Left(m_cadBreak.GetLength()-1);
else
break;
cont--;
}
m_cadBreak+=_T("...");
rectText.right+=3;
dc->DrawText(m_cadBreak,rectText,DT_SINGLELINE|DT_LEFT|DT_VCENTER);
CToolTip.SetToolRect(this,iCont+1,&ct->rect);
}
}
dc->SetBkMode(nMode);
// Modified By SunZhenyu
dc->SelectObject(oldPen);
}
dc->SelectObject(m_fontOld);
//.........这里部分代码省略.........
示例11: DrawFolder
void CGuiVisioFolder::DrawFolder(CFolderBar* cfb,Style m_Style)
{
CRect rc=cfb->m_rect;
CRect rcWin=cfb->m_rect;
int nNuImage=cfb->m_img;
CString szStringPoints=_T("...");
CBrush cb;
CClientDC pDC(this);
cb.CreateSysColorBrush(COLOR_BTNFACE);
rc.top+=1;
pDC.FillRect(&rc,&cb);
//se pintan bordes que simulen un boton
if (m_Style == mNormal) //el folder no tiene el mouse
{
pDC.Draw3dRect(rc, GuiDrawLayer::GetRGBColorBTNHigh(),GuiDrawLayer::GetRGBColorShadow());
rc.DeflateRect(1,1);
pDC.Draw3dRect(rc, GuiDrawLayer::GetRGBColorFace(),GuiDrawLayer::GetRGBColorShadow());
}
else if (m_Style == mFlat) //el mouse esta sobre el folder pero no presiona
pDC.Draw3dRect(rc, GuiDrawLayer::GetRGBColorBTNHigh(),GuiDrawLayer::GetRGBColorShadow());
else if (m_Style == mPush) //el mouse esta sobre el folder y presiona
pDC.Draw3dRect(rc, GuiDrawLayer::GetRGBColorShadow(),GuiDrawLayer::GetRGBColorBTNHigh());
int OldMode=pDC.SetBkMode(TRANSPARENT);
cfont = pDC.SelectObject(CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)));
CString m_cadBreak=cfb->m_lpMsg;
int cont=m_cadBreak.GetLength();
CSize coor=pDC.GetTextExtent(m_cadBreak,m_cadBreak.GetLength());
CSize szImage=CSize(0,0);
//se dibuja la imagen
if(nNuImage != -1)
{
IMAGEINFO pImageInfo;
m_Img.GetImageInfo(nNuImage,&pImageInfo);
CRect rcima =pImageInfo.rcImage;
szImage=CSize(rcima.Width(),rcima.Height());
CPoint pti=CPoint(rc.left+2,rc.top+3);
m_Img.Draw(&pDC, nNuImage, pti, ILD_TRANSPARENT);
}
//guardar espacio para la imagen
rc.left+=szImage.cx+4;
rc.right-=8;
if ( coor.cx > rc.Width())
{
rc.left+=1;
while(cont > 1 )
{
CString m_scadtemp=m_cadBreak+szStringPoints;
CSize coor=pDC.GetTextExtent(m_scadtemp,m_scadtemp.GetLength());
if(coor.cx > rc.Width())
m_cadBreak=m_cadBreak.Left(m_cadBreak.GetLength()-1);
else
break;
cont--;
}
m_cadBreak+=szStringPoints;
rc.right+=3;
pDC.DrawText(m_cadBreak,rc,DT_SINGLELINE|DT_LEFT|DT_VCENTER);
}
else
pDC.DrawText(cfb->m_lpMsg,rc,DT_WORDBREAK|DT_SINGLELINE|DT_CENTER|DT_VCENTER);
//----se dibuja el gripper----------
rcWin.top+=5;
rcWin.right-=4;
rcWin.left=rcWin.right-3;
rcWin.bottom-=4;
for (int i=0; i < rcWin.Height(); i+=2)
{
CRect rcWindow;
CBrush cb;
cb.CreateSolidBrush(::GetSysColor(COLOR_BTNSHADOW));
rcWindow=rcWin;
rcWindow.top=rcWin.top+i;
rcWindow.bottom=rcWindow.top+1;
pDC.FillRect(rcWindow,&cb);
cb.DeleteObject();
}
//-------------------------
cb.DeleteObject();
pDC.SetBkColor(OldMode);
}