本文整理汇总了C++中CDCHandle::FillSolidRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CDCHandle::FillSolidRect方法的具体用法?C++ CDCHandle::FillSolidRect怎么用?C++ CDCHandle::FillSolidRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CDCHandle
的用法示例。
在下文中一共展示了CDCHandle::FillSolidRect方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void CToolBarPropertyPage::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
if (lpDrawItemStruct->CtlID == IDC_LIST_ICON) {
CDCHandle dc = lpDrawItemStruct->hDC;
// Save these value to restore them when done drawing.
COLORREF crOldTextColor = dc.GetTextColor();
COLORREF crOldBkColor = dc.GetBkColor();
// If this item is selected, set the background color
// and the text color to appropriate values. Also, erase
// rect by filling it with the background color.
if ((lpDrawItemStruct->itemAction | ODA_SELECT) &&
(lpDrawItemStruct->itemState & ODS_SELECTED))
{
dc.SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
dc.SetBkColor(::GetSysColor(COLOR_HIGHLIGHT));
dc.FillSolidRect(&lpDrawItemStruct->rcItem,
::GetSysColor(COLOR_HIGHLIGHT));
} else
dc.FillSolidRect(&lpDrawItemStruct->rcItem, crOldBkColor);
#if 0
// If this item has the focus, draw a red frame around the
// item's rect.
if ((lpDrawItemStruct->itemAction | ODA_FOCUS) &&
(lpDrawItemStruct->itemState & ODS_FOCUS))
{
CBrush br;
br.CreateSolidBrush(RGB(255, 0, 0));
dc.FrameRect(&lpDrawItemStruct->rcItem, br);
}
#endif
IconListData* pData = (IconListData*)lpDrawItemStruct->itemData;
if (pData) {
CIconHandle icon = m_imgList.GetIcon(pData->nIndex);
if (icon.m_hIcon)
icon.DrawIconEx(dc, lpDrawItemStruct->rcItem.left + cxMargin, lpDrawItemStruct->rcItem.top + cyMargin, m_iconSize.cx, m_iconSize.cy);
lpDrawItemStruct->rcItem.left += m_iconSize.cx + cxMargin + IconTextMargin;
// Draw the text.
dc.DrawText(
pData->strText,
pData->strText.GetLength(),
&lpDrawItemStruct->rcItem,
DT_SINGLELINE | DT_VCENTER);
}
// Reset the background color and the text color back to their
// original values.
dc.SetTextColor(crOldTextColor);
dc.SetBkColor(crOldBkColor);
}
}
示例2: OnEraseBkgnd
BOOL CBigFileListCtrl::OnEraseBkgnd(CDCHandle dc)
{
CRect rcClient;
GetClientRect(rcClient);
dc.FillSolidRect(rcClient, RGB(0xff, 0xff, 0xff));
return TRUE;
}
示例3: OnEraseBackground
LRESULT CPreviewWindow::OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
CDCHandle dc = (HDC) wParam;
RECT rc;
GetClientRect(&rc);
rc.bottom = rc.top + 21;
dc.FillSolidRect(&rc, RGB(174, 169, 167));
GetClientRect(&rc);
rc.top += 21;
dc.Draw3dRect(rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, RGB(103, 99, 96), RGB(200, 199, 196));
CFontHandle oldFont = dc.SelectFont(AtlGetDefaultGuiFont());
dc.SetTextColor(RGB(0, 0, 0));
dc.SetBkMode(TRANSPARENT);
const sChar *desc = "(no view item)";
frOpGraph::opMapIt it = g_graph->m_ops.find(m_client.m_curOp);
if (it != g_graph->m_ops.end())
desc = it->second.plg->getDisplayName();
dc.TextOut(176, 3, desc);
dc.SelectFont(oldFont);
return 1;
}
示例4: DrawButtons
void CDxMonthPicker::DrawButtons(CDCHandle dc)
{
if (m_btnToday->m_bVisible)
{
dc.FillSolidRect(m_btnToday->m_rcButton, GetSysColor(COLOR_BTNFACE));
CRect rcButtonX = m_btnToday->m_rcButton;
rcButtonX.DeflateRect(1, 1, 1, 1);
if (m_btnToday->m_bPressed)
{
dc.Draw3dRect(m_btnToday->m_rcButton, GetSysColor(COLOR_BTNTEXT), GetSysColor(COLOR_BTNFACE));
dc.Draw3dRect(rcButtonX, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
}
else
{
dc.Draw3dRect(m_btnToday->m_rcButton, GetSysColor(COLOR_BTNFACE), GetSysColor(COLOR_BTNTEXT));
dc.Draw3dRect(rcButtonX, GetSysColor(COLOR_3DHILIGHT), GetSysColor(COLOR_3DSHADOW));
}
HFONT hFontOld = (HFONT)dc.SelectFont(CDxFontManager::GetSingleton().GetFont(DUIF_DEFAULTFONT));
CString strCaption = _T("Today");
dc.SetTextColor(RGB(0,0,0));
dc.DrawText(strCaption, strCaption.GetLength(), rcButtonX, DT_VCENTER | DT_CENTER | DT_SINGLELINE);
}
}
示例5: DrawMonthHeader
void CDxDatePickerMonth::DrawMonthHeader(CDCHandle dc)
{
if (m_rcHeader.IsRectEmpty())
return;
COleDateTime dtMonth = GetMonth();
CRect rcHeader = m_rcHeader;
CRect rcLeftScroll = m_rcLeftScroll;
CRect rcRightScroll = m_rcRightScroll;
CRect rcClient(m_pControl->m_rcControl);
//dc.Draw3dRect(0, 0, rcClient.Width(), rcClient.Height(), m_clrStaticBorder, m_clrStaticBorder);
CRect rcHeaderBk = m_rcMonth;
rcHeaderBk.bottom = rcHeader.bottom;
// fill background
dc.FillSolidRect(rcHeaderBk, RGB(191, 219, 255));
// draw header text
dc.SetBkColor(GetSysColor(COLOR_BTNFACE));
dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
HFONT hFontOld = (HFONT)dc.SelectFont(CDxFontManager::GetSingleton().GetFont(DUIF_DEFAULTFONT));
CString strText;
if (!m_pControl->m_strYearMonthFormat.IsEmpty())
{
//strText = GetDateFormat(dtMonth, pControl->m_strYearMonthFormat);
}
else
{
strText.Format(_T("%s %d"), (LPCTSTR)m_pControl->GetMonthName( dtMonth.GetMonth()), dtMonth.GetYear());
}
dc.DrawText(strText, strText.GetLength(), &rcHeader, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
// draw left scroll triangle
if (!rcLeftScroll.IsRectEmpty())
{
// draw left triangle itself
if (GetShowLeftScroll())
DrawScrollTriangle(dc, rcLeftScroll, TRUE, m_clrMonthHeaderButton, m_pControl->m_bYearsTriangle);
}
// draw right scroll triangle
if (!rcRightScroll.IsRectEmpty())
{
// draw right triangle itself
if (GetShowRightScroll())
DrawScrollTriangle(dc, rcRightScroll, FALSE, m_clrMonthHeaderButton, m_pControl->m_bYearsTriangle);
}
dc.SelectFont(hFontOld);
}
示例6: OnPaint
void CDuiColorPicker::OnPaint( CDCHandle dc )
{
CRect rcClient;
GetClient(&rcClient);
ALPHAINFO ai;
CGdiAlpha::AlphaBackup(dc,rcClient,ai);
dc.FillSolidRect(&rcClient,m_crCur);
dc.DrawEdge(&rcClient, BDR_RAISEDINNER, BF_RECT);
CGdiAlpha::AlphaRestore(dc,ai);
}
示例7: OnEraseBkgnd
LRESULT CNativeToolbar::OnEraseBkgnd(UINT /*uMsg*/, WPARAM wParam, LPARAM /*lParam*/, BOOL& bHandled)
{
CRect rect;
GetClientRect(rect);
CDCHandle hdc = (HDC)wParam;
hdc.FillSolidRect(rect, m_rgbBackColor );
bHandled = TRUE;
return 1;
}
示例8: OnPaint
void CDxMonthPicker::OnPaint(CDCHandle dc)
{
CRect rcClient;
GetRect(rcClient);
// draw background
dc.FillSolidRect(rcClient, m_clrControlBack);
// draw all month items in the collection
m_monthPicker->Draw(dc);
// draw today/none buttons
DrawButtons(dc);
// draw border
//COLORREF m_clrStaticBorder = RGB(255,255,0);
//dc.Draw3dRect(0, 0, rcClient.Width(), rcClient.Height(), m_clrStaticBorder, m_clrStaticBorder);
}
示例9: OnDraw
void CColorCell::OnDraw(CDCHandle dc)
{
CBrush brush;
brush.CreateSolidBrush(m_crCell);
CBrushHandle brushOld = dc.SelectBrush(brush);
CPenHandle penOld = dc.SelectStockPen(NULL_PEN);
CRect rcPos;
rcPos = m_rcPosition;
dc.FillSolidRect(rcPos, GetSysColor(COLOR_BTNFACE));
rcPos.DeflateRect(m_nCellBorderSize, m_nCellBorderSize);
if (!m_bAtFirstType)
{
dc.Rectangle(rcPos);
}
else
{
dc.Polygon (m_Points, 6);
}
dc.SelectBrush(brushOld);
dc.SelectPen(penOld);
}
示例10: if
void
CNBTreeListView::DrawTreeItem(LPNMTVCUSTOMDRAW lptvcd, UINT iState, const RECT& rcItem)
{
CDCHandle dc = lptvcd->nmcd.hdc;
HTREEITEM hItem = (HTREEITEM) lptvcd->nmcd.dwItemSpec;
tMapItem* pVal = m_mapItems.Lookup(hItem);
if( pVal == NULL ) return;
// NOTE: Having an ImageList attached to the TreeView control seems
// to produce some extra WM_ERASEBKGND msgs, which we can use to
// optimize the painting...
CImageList il = m_ctrlTree.GetImageList(TVSIL_NORMAL);
// If the item had focus then draw it
// NOTE: Only when images are used (see note above)
// FIX-BY-PATRIA: DrawFocusRect should be done later
//if( (iState & CDIS_FOCUS) != 0 && !il.IsNull() ) {
// RECT rcFocus = rcItem;
// rcFocus.left = 1;
// dc.SetTextColor(::GetSysColor(COLOR_BTNTEXT));
// dc.DrawFocusRect(&rcFocus);
//}
// If it's selected, paint the selection background
if( iState & CDIS_SELECTED && iState & CDIS_FOCUS) {
RECT rcHigh = rcItem;
dc.FillSolidRect(&rcHigh, ::GetSysColor(COLOR_HIGHLIGHT));
}
else if( il.IsNull() ) {
RECT rcHigh = rcItem;
dc.FillSolidRect(&rcHigh, lptvcd->clrTextBk);
}
// Always write text with background
dc.SetBkMode(OPAQUE);
dc.SetBkColor(::GetSysColor((iState & CDIS_SELECTED) != 0 ? COLOR_HIGHLIGHT : COLOR_WINDOW));
// Draw all columns of the item
RECT rc = rcItem;
int cnt = pVal->GetSize();
for( int i = 0; i < cnt; i++ ) {
LPTLVITEM pItem = (*pVal)[i];
ATLASSERT(pItem);
if( i != 0 ) rc.left = m_rcColumns[i].left;
rc.right = m_rcColumns[i].right;
if( pItem->mask & TLVIF_IMAGE ) {
ATLASSERT(!il.IsNull());
int cx, cy;
il.GetIconSize(cx, cy);
il.DrawEx(
pItem->iImage,
dc,
rc.left, rc.top,
MIN(cx, rc.right - rc.left), cy,
CLR_NONE, CLR_NONE,
ILD_TRANSPARENT);
rc.left += cx;
}
if( pItem->mask & TLVIF_TEXT ) {
rc.left += 2;
COLORREF clrText = lptvcd->clrText;
if( pItem->mask & TLVIF_TEXTCOLOR ) clrText = pItem->clrText;
if( iState & CDIS_SELECTED ) clrText = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
dc.SetTextColor(clrText);
CFont font;
HFONT hOldFont = NULL;
if( pItem->mask & TLVIF_STATE ) {
LOGFONT lf;
::GetObject(m_ctrlTree.GetFont(), sizeof(LOGFONT), &lf);
if( pItem->state & TLVIS_BOLD ) lf.lfWeight += FW_BOLD - FW_NORMAL;
if( pItem->state & TLVIS_ITALIC ) lf.lfItalic = TRUE;
if( pItem->state & TLVIS_UNDERLINE ) lf.lfUnderline = TRUE;
if( pItem->state & TLVIS_STRIKEOUT ) lf.lfStrikeOut = TRUE;
font.CreateFontIndirect(&lf);
ATLASSERT(!font.IsNull());
hOldFont = dc.SelectFont(font);
}
UINT format = pItem->mask & TLVIF_FORMAT ? pItem->format : 0;
if (0 == i)
{
CNBDevice* pDevice = (CNBDevice*) m_ctrlTree.GetItemData(hItem);
if (NULL != pDevice && pDevice->GetIDString(_T('*')).GetLength() > 0)
{
CString strBottom = pDevice->GetIDString(m_chHidden);
CRect rcTop = rc; rcTop.DeflateRect(0, 0, 0, rcTop.Height() / 2);
CRect rcBottom = rc; rcBottom.top = rcTop.bottom;
dc.FillSolidRect(&rc, lptvcd->clrTextBk);
LOGFONT lf;
//.........这里部分代码省略.........
示例11: DrawBitmap
RectF CRender::DrawBitmap(
CDCHandle& dc,
const RectF& rText,
IPicture* image,
const HTMLElement* element,
const PLACEMENT& placement)
{
if (image == NULL && (element == NULL || element->GetHtmlElement() == NULL))
return rText;
LONG width, height;
RectF rImg;
if (image != NULL)
{
image->get_Width( &width );
image->get_Height( &height );
CSize szPic(width, height);
// convert OLE size into pixels
dc.HIMETRICtoDP( &szPic );
rImg.Width = static_cast<float>(szPic.cx);
rImg.Height = static_cast<float>(szPic.cy);
}
else if (element != NULL)
{
rImg = element->GetSize();
}
HRESULT hr = S_OK;
//COLORREF transparent = RGB(253,0,200);
COLORREF transparent = RGB(0,0,211); // C# transparent gif background color
CMemBm bmp(dc, 0, 0, 0, (int)rImg.Width, (int)rImg.Height);
CDCHandle hdcMem = bmp;
hdcMem.FillSolidRect(0, 0, (int)rImg.Width, (int)rImg.Height, transparent);
if (image != NULL)
{
hr = image->Render(
hdcMem,
0,
long(rImg.Height),
long(rImg.Width),
long(-rImg.Height),
0,
0,
width, height, NULL );
}
else if (element != NULL && element->GetHtmlElement() != NULL)
{
hr = element->GetHtmlElement()->DrawToDC(hdcMem);
}
//TODO over support
if (/*m_overNode != v ||*/ GetScale() > 1.0f)
{
ScaleTransform(rImg);
}
AdjustOffsets(rImg, rText, placement);
bmp.DrawTrans(
dc,
int(rImg.x),
int(rImg.y),
int(rImg.Width),
int(rImg.Height),
transparent);
return rImg;
}
示例12: DrawDaysOfWeek
void CDxDatePickerMonth::DrawDaysOfWeek(CDCHandle dc)
{
if (m_rcDaysOfWeek.IsRectEmpty())
return;
// fill background
dc.FillSolidRect(m_rcDaysOfWeek, m_clrDaysOfWeekBack);
// draw days of week text
dc.SetBkColor(m_clrDaysOfWeekBack);
dc.SetTextColor(m_clrDaysOfWeekText);
HFONT hFontOld = (HFONT)dc.SelectFont(CDxFontManager::GetSingleton().GetFont(DUIF_DEFAULTFONT));
int nMaxX = 0;
SIZE szText;
dc.GetTextExtent(_T("XX"), 2, &szText);
int nTwoLetterWidth = szText.cx;
int nWholeLetterWidth = 0;
for (int i = 0; i < XTP_WEEK_DAYS; i++)
{
CString strText(m_pControl->GetDayOfWeekName(i));
dc.GetTextExtent(strText, strText.GetLength(), &szText);
nWholeLetterWidth = max(nWholeLetterWidth, szText.cx);
}
for (int nDayDelta = 0; nDayDelta < XTP_WEEK_DAYS; nDayDelta++)
{
// calc item rect
CDxDatePickerDay* pDay = GetDay(nDayDelta);
CRect rcItem(pDay->GetRect());
rcItem.top = m_rcDaysOfWeek.top;
rcItem.bottom = m_rcDaysOfWeek.bottom - 2;
nMaxX = rcItem.right;
// get item text
CString strText(m_pControl->GetDayOfWeekName(pDay->GetDate().GetDayOfWeek()));
// Check if we can draw whole text
if (nWholeLetterWidth + 4 <= rcItem.Width())
{
dc.DrawText(strText, strText.GetLength(), &rcItem, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
}
else if (nTwoLetterWidth + 4 <= rcItem.Width()) // Draw 2 letters
{
int nChrLen = (int)_tcsnbcnt(strText, 2);
dc.DrawText(strText, nChrLen, &rcItem, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
}
else // Draw only first letter
{
int nChrLen = (int)_tcsnbcnt(strText, 1);
dc.DrawText(strText, nChrLen, &rcItem, DT_SINGLELINE | DT_VCENTER | DT_CENTER);
}
}
// draw bottom line on days of the week
CRect rcBottomLine(m_rcDaysOfWeek);
rcBottomLine.bottom--;
rcBottomLine.top = rcBottomLine.bottom - 1;
rcBottomLine.left = m_rcWeekNumbers.right - 1;
rcBottomLine.right = nMaxX;
dc.FillSolidRect(rcBottomLine, m_clrMonthBorder);
dc.SelectFont(hFontOld);
}
示例13: OnEraseBackground
LRESULT CAnimMixer::OnEraseBackground(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
drawBar(1);
CDCHandle dc = (HDC) wParam;
// prepare...
CRect rc;
GetClientRect(&rc);
CFontHandle oldFont = dc.SelectFont(AtlGetDefaultGuiFont());
dc.SetTextColor(RGB(0, 0, 0));
dc.SetBkMode(TRANSPARENT);
CPen blackPen;
blackPen.CreatePen(PS_SOLID, 1, RGB(0, 0, 0));
CPenHandle oldPen = dc.SelectPen(blackPen);
// fill background
dc.FillSolidRect(&rc, RGB(174, 169, 167));
// draw tl bar at y 45
dc.MoveTo(mapTime(0), 45);
dc.LineTo(rc.right, 45);
// track grid
CPen pen_grid;
pen_grid.CreatePen(PS_DOT, 1, RGB(174*3/4, 169*3/4, 167*3/4)^RGB(174, 169, 167));
dc.SelectPen(pen_grid);
dc.SetROP2(R2_XORPEN);
dc.SetBkColor(RGB(0, 0, 0));
dc.SetBkMode(TRANSPARENT);
for (sInt trackY=46+22; trackY<rc.bottom; trackY+=22)
{
dc.MoveTo(mapTime(0), trackY);
dc.LineTo(rc.right, trackY);
}
// bar marks
dc.SetROP2(R2_COPYPEN);
dc.SelectPen(blackPen);
const sF32 xstep = 60000.0f / g_graph->m_bpmRate;
const sF32 ixstep = g_graph->m_bpmRate / (60000.0f * m_frameStep);
const sInt xms = (m_startPixel) * ixstep;
const sInt xme = (m_startPixel + rc.right) * ixstep;
LOGFONT lf;
((CFontHandle) AtlGetDefaultGuiFont()).GetLogFont(lf);
if (lf.lfHeight<0)
lf.lfHeight=MulDiv(-lf.lfHeight, dc.GetDeviceCaps(LOGPIXELSY), 72);
for (sInt i=fr::maximum(xms-1,0); i<=xme+1; i++)
{
const sInt xpos=mapTime(i*xstep);
const sInt beat=i&3;
dc.MoveTo(xpos, 45);
dc.LineTo(xpos, 37-(beat==0)*2);
TCHAR buf[32];
sprintf(buf, "%d.%d", i/4, beat);
dc.SetTextAlign(TA_BOTTOM|(i?TA_CENTER:TA_LEFT));
dc.TextOut(xpos, 35, buf);
if (!beat)
{
dc.MoveTo(xpos, rc.bottom);
dc.LineTo(xpos, 45);
}
}
dc.SelectPen(oldPen);
dc.SelectFont(oldFont);
return 1;
}
示例14: DoDrawItem
void CBigFileListCtrl::DoDrawItem(CDCHandle dc, LPDRAWITEMSTRUCT lpDrawItemStruct)
{
CRect rcItem = lpDrawItemStruct->rcItem;
size_t idx = (size_t)lpDrawItemStruct->itemData;
int nItem = lpDrawItemStruct->itemID;
BOOL bSelect = lpDrawItemStruct->itemState & ODS_SELECTED;
CRect rcDraw;
CVirtualDirManager* pDir = (CVirtualDirManager*)m_pOwner;
CString strFilePath, strFile, strDir;
HICON hIcon = NULL, hIconCache = NULL;
int nCurrentEnd = rcItem.left;
double percent;
CRect rcClient;
CFontHandle underlineFont = KuiFontPool::GetFont(FALSE, TRUE, FALSE);
CFontHandle normalFont = KuiFontPool::GetFont(FALSE, FALSE, FALSE);
// 绘制背景
{
rcDraw = rcItem;
GetClientRect(rcClient);
if (rcClient.right > rcDraw.right)
rcDraw.right = rcClient.right;
dc.FillSolidRect(rcDraw, RGB(0xff,0xff,0xff));
}
if (idx == -1)
{
CString strMore;
dc.SelectFont(underlineFont);
dc.SetTextColor(RGB(0x4d, 0x70, 0x96));
strMore.Format(
//_T("已经显示了%d个文件,还有%d个没有显示,点击此处查看全部"),
_T("还有%d个没有显示,点击此处查看全部"),
//GetItemCount() - 1,
m_dwMoreItems);
rcDraw = rcItem;
dc.FillSolidRect(rcDraw, RGB(0xff, 0xff, 0xff));
int nLeft = rcItem.left + GetColumnWidth(0) + GetColumnWidth(1);
int nRight = nLeft + GetColumnWidth(2);
rcDraw.left = nLeft;
rcDraw.right = nRight;
dc.DrawText(strMore, strMore.GetLength(), rcDraw, DT_LEFT|DT_BOTTOM|DT_SINGLELINE|DT_CALCRECT);
if (rcDraw.right > nRight)
rcDraw.right = nRight;
dc.DrawText(strMore, strMore.GetLength(), rcDraw, DT_LEFT|DT_BOTTOM|DT_SINGLELINE|DT_END_ELLIPSIS);
m_rcMore.left = rcDraw.left;
m_rcMore.right = rcDraw.right;
m_rcMore.top = 0;
m_rcMore.bottom = m_nItemHeight;
return;
}
if (idx == -2)
{
CString strNone;
dc.SelectFont(normalFont);
dc.SetTextColor(RGB(0, 0, 0));
strNone = _T("没有发现文件,您可以重新扫描。");
rcDraw = rcItem;
dc.FillSolidRect(rcDraw, RGB(0xff, 0xff, 0xff));
rcDraw.left = rcItem.left + GetColumnWidth(0) + GetColumnWidth(1);
rcDraw.right = rcDraw.left + GetColumnWidth(2);
dc.DrawText(strNone, strNone.GetLength(), rcDraw, DT_LEFT|DT_BOTTOM|DT_SINGLELINE|DT_END_ELLIPSIS);
return;
}
percent = (double)pDir->m_vCacheFiles[idx].qwFileSize / pDir->m_vCacheFiles[0].qwFileSize;
rcDraw = rcItem;
dc.SetTextColor(RGB(0,0,0));
if (bSelect)
{
CPen penBorder;
CBrush brushBk;
CRect rcSelect = rcDraw;
penBorder.CreatePen(PS_SOLID, 1, RGB(0x7d, 0xa2, 0xce));
brushBk.CreateSolidBrush(RGB(0xeb, 0xf4, 0xfd));
dc.SelectPen(penBorder);
dc.SelectBrush(brushBk);
dc.RoundRect(rcSelect, CPoint(3, 3));
rcSelect.left += 2;
rcSelect.right -= 2;
rcSelect.top += 2;
rcSelect.bottom -= 2;
DrawGradualColorRect(dc, rcSelect, RGB(0xdd, 0xec, 0xfd), RGB(0xc2, 0xdc, 0xfd));
}
else
{
dc.FillSolidRect(rcDraw, RGB(0xff, 0xff, 0xff));
}
{
// 画背景进度条
CRect rcProgress = rcDraw;
rcProgress.left += 2;
rcProgress.right -= 2;
rcProgress.top += 2;
rcProgress.bottom -= 2;
rcProgress.right = rcProgress.left + int(rcProgress.Width() * percent);
COLORREF color1 = RGB(0xff, 0xf4, 0xcc);
COLORREF color2 = RGB(0xff, 0xde, 0x5c);
//.........这里部分代码省略.........
示例15: DrawDay
BOOL CDxDatePickerDay::DrawDay(CDCHandle dc)
{
// check this day item
BOOL bThisMonthItem = FALSE;
BOOL bNextMonthItem = FALSE;
BOOL bPreviousMonthItem = FALSE;
CDxMonthPicker* pControl = GetDatePicker();
CDxDatePickerMonth* pMonth = GetMonth();
COleDateTime dtDay = GetDate();
CRect rcDay = GetRect();
if (dtDay.GetYear() > pMonth->GetMonth().GetYear())
{
bNextMonthItem = TRUE;
}
else if (dtDay.GetYear() < pMonth->GetMonth().GetYear())
{
bPreviousMonthItem = TRUE;
}
else
{
// years the same
if (dtDay.GetMonth() > pMonth->GetMonth().GetMonth())
bNextMonthItem = TRUE;
else if (dtDay.GetMonth() < pMonth->GetMonth().GetMonth())
bPreviousMonthItem = TRUE;
else // months the same
bThisMonthItem = TRUE;
}
if (bPreviousMonthItem && !pMonth->GetShowDaysBefore())
return FALSE;
if (bNextMonthItem && !pMonth->GetShowDaysAfter())
return FALSE;
// apply settings to the DC
dc.SetBkMode(TRANSPARENT);
dc.SetTextColor(GetSysColor(COLOR_WINDOWTEXT));
dc.FillSolidRect(rcDay, GetSysColor(COLOR_WINDOW));
// change default drawing metrics if day is selected
if (pControl->IsSelected(dtDay))
{
dc.SetTextColor(GetSysColor(COLOR_WINDOW));
dc.FillSolidRect(rcDay, GetSysColor(COLOR_WINDOWTEXT));
}
// make a text for drawing
CString strText;
strText.Format(_T("%i"), dtDay.GetDay());
// draw item content
{
// draw item text
HFONT hFontOld = (HFONT)dc.SelectFont(CDxFontManager::GetSingleton().GetFont(DUIF_DEFAULTFONT));
dc.DrawText(strText, strText.GetLength(), &rcDay, DT_SINGLELINE | DT_VCENTER | DT_CENTER | DT_NOCLIP);
}
CRect rcFocus = rcDay;
BOOL bToday = FALSE;
// highlight today item
if (IsToday(dtDay))
{
dc.Draw3dRect(rcDay, GetSysColor(COLOR_HIGHLIGHT), GetSysColor(COLOR_HIGHLIGHT));
bToday = TRUE;
}
if (pControl->IsSelected(dtDay))
{
if (!bToday)
{
dc.SetTextColor(0);
dc.SetBkColor(RGB(255, 255, 255));
dc.DrawFocusRect(&rcFocus);
}
else
{
COLORREF clrFocus = GetSysColor(COLOR_HIGHLIGHT);
clrFocus = clrFocus ^ RGB(255, 128, 128);
rcFocus.DeflateRect(0, 0, 1, 1);
CPen pen1;
pen1.CreatePen(PS_DOT, 1, clrFocus);
HPEN hOldPen = dc.SelectPen(pen1);
dc.MoveTo(rcFocus.TopLeft());
dc.LineTo(rcFocus.right, rcFocus.top);
dc.LineTo(rcFocus.right, rcFocus.bottom);
dc.LineTo(rcFocus.left, rcFocus.bottom);
dc.LineTo(rcFocus.left, rcFocus.top);
dc.SelectPen(hOldPen);
}
//.........这里部分代码省略.........