本文整理汇总了C++中CPaintDC::FillRect方法的典型用法代码示例。如果您正苦于以下问题:C++ CPaintDC::FillRect方法的具体用法?C++ CPaintDC::FillRect怎么用?C++ CPaintDC::FillRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CPaintDC
的用法示例。
在下文中一共展示了CPaintDC::FillRect方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawSquare
void CDepartmentEstimationDialog::DrawSquare(CPaintDC &dc, COLORREF Color, int l, int t, int r, int b)
{
CRect UserRect(l, t, r, b);
CBrush brush(Color);
dc.FillRect(UserRect, &brush);
brush.DeleteObject();
}
示例2: _DoPaint
BOOL CSkinScrollWnd::_DoPaint()
{
//bHandled = FALSE;
CPaintDC dc ( m_hWnd );
CRect rcClient;
GetClientRect ( &rcClient );
CRect rcFill;
rcFill.SetRectEmpty();
INT32 nLeft = 0, nTop = 0;
if ( 1 == m_nAngleType ) // LeftScrollBar
{
nLeft = rcClient.left;
nTop = rcClient.bottom - m_nScrollWidth;
rcFill.SetRect ( nLeft, nTop, nLeft + m_nScrollWidth, nTop + m_nScrollWidth );
}
else if ( 2 == m_nAngleType )
{
nLeft = rcClient.right - m_nScrollWidth;
nTop = rcClient.bottom - m_nScrollWidth;
rcFill.SetRect ( nLeft, nTop, nLeft + m_nScrollWidth, nTop + m_nScrollWidth );
}
if ( !rcFill.IsRectEmpty() )
{
CRgn rgn;
rgn.CreateRectRgnIndirect(&rcFill);
dc.SelectClipRgn(rgn);
dc.FillRect(rcFill, m_brBackground);
m_imgCorner.Draw( dc.m_hDC, rcFill.left, rcFill.top, rcFill.Width(), rcFill.Height() );
}
return TRUE;
}
示例3: drawValues
void CInspectorTreeCtrl::drawValues(CPaintDC & dc)
{
CRect rect;
GetWindowRect(rect);
dc.SetViewportOrg(0, 0);
dc.SelectObject(linePen);
dc.SetBkMode(TRANSPARENT);
dc.SelectObject(GetFont());
dc.SetTextColor(color_windowtext);
DRAWLINE(0, 0, rect.right, 0);
int cWid0 = getColumnWidth(0);
int cWid1 = getColumnWidth(1);
int height = 0;
HTREEITEM hItemFocus = GetSelectedItem();
HTREEITEM hItem = GetFirstVisibleItem();
while(hItem && height < rect.Height())
{
CRect iRect;
GetItemRect(hItem, &iRect, FALSE);
DRAWLINE(0, iRect.bottom, rect.right, iRect.bottom);
height += iRect.Height();
CTreeListItem * itemData = GetTreeListItem(hItem);
if(itemData)
{
iRect.left = cWid0 + 6;
iRect.right = cWid0 + cWid1;
if(hItem == hItemFocus)
{
CRect whitespaceRect;
GetItemRect(hItem, &whitespaceRect, TRUE);
if(whitespaceRect.right < cWid0)
{
whitespaceRect.left = whitespaceRect.right;
whitespaceRect.right = cWid0;
CWnd * focusWnd = GetFocus();
if(focusWnd && (focusWnd->m_hWnd == m_hWnd)) // I have focus
dc.FillRect(whitespaceRect, &whitespaceHighlightBrush_Focused);
else
dc.FillRect(whitespaceRect, &whitespaceHighlightBrush_Unfocused);
}
CString xpath;
getTypeText(itemData->getType(), xpath, true);
if(getFullXPath(hItem, xpath))
{
CRect itemRect, r;
GetItemRect(hItem, &itemRect, FALSE);
r.UnionRect(&itemRect, &whitespaceRect);
tooltipCtrl->DelTool(this, TREE_TOOLTIP_ID);
tooltipCtrl->AddTool(this, xpath, r, TREE_TOOLTIP_ID);
}
}
dc.DrawText(itemData->getValue(), &iRect, DT_SINGLELINE | DT_LEFT);
}
hItem = GetNextVisibleItem(hItem);
}
DRAWLINE(cWid0, 0, cWid0, height);
}
示例4: OnPaint
void CLeftPanelDlgBar::OnPaint()
{
CPaintDC dc (this); // device context for painting
CDC dcMem;
dcMem.CreateCompatibleDC (&dc);
CBrush brush (::GetSysColor (COLOR_3DFACE));
CMDIChildWnd* pChild = ((CMDIFrameWnd*) AfxGetMainWnd ())->MDIGetActive ();
CRect r;
GetClientRect (&r);
if (pChild == NULL)
{
dc.FillRect (&r, &brush);
goto __end;
}
CCdCoverCreator2Doc* pDoc = (CCdCoverCreator2Doc*) pChild->GetActiveDocument ();
if (pDoc == NULL)
{
// look whether the last doc is still valid
POSITION pos = AfxGetApp ()->GetFirstDocTemplatePosition ();
CDocTemplate* pDocTmpl = AfxGetApp ()->GetNextDocTemplate (pos);
bool bIsValid = false;
for (pos = pDocTmpl->GetFirstDocPosition (); pos; )
if (pDocTmpl->GetNextDoc (pos) == m_pLastDoc)
{
bIsValid = true;
break;
}
if (bIsValid)
pDoc = m_pLastDoc;
else
m_pLastDoc = NULL;
}
else
m_pLastDoc = pDoc;
if (pDoc == NULL)
{
dc.FillRect (&r, &brush);
goto __end;
}
CRect rect;
GetClientRect (rect);
rect.DeflateRect (5, 5, 5, 5);
if (pDoc->m_pStyle != NULL)
{
CCdCoverCreator2View* pView = (CCdCoverCreator2View*) pChild->GetActiveView ();
if (pView == NULL)
goto __end;
int nHeight = (rect.Width () / 5) * 4;
CRenderDC rdc (&dc, nHeight, pView->GetDocument ()->m_pStyle);
m_y[Cover] = 5;
m_y[Back] = m_y[Cover] + rdc.GetHeight (Cover) + 10;
m_y[Inlay] = m_y[Back] + rdc.GetHeight (Back) + 10;
m_y[Label] = m_y[Inlay] + rdc.GetHeight (Inlay) + 10;
m_y[Booklet] = m_y[Label] + rdc.GetHeight (Label) + 10;
if (m_bRedraw)
{
CLabelRenderer renderer (pDoc->m_pTracks, pDoc->m_pDataCDInfo,
reinterpret_cast<CBackgroundInfo**> (&(pDoc->m_pBackground)),
pDoc->m_listFloatingObjects, *(pDoc->m_pStyle));
for (int i = 0; i < NUM_RENDER_TYPES - 1; i++)
{
if ((RenderType) i == Booklet)
continue;
CRect rectBmp (0, 0, rdc.GetWidth ((RenderType) i) + 5, /*nHeight*/(m_y[i + 1] - m_y[i]) + 5);
m_Bitmap[i].DeleteObject ();
m_Bitmap[i].CreateCompatibleBitmap (&dc, rectBmp.right, rectBmp.bottom);
// render
dcMem.SelectObject (&m_Bitmap[i]);
dcMem.FillRect (rectBmp, &brush);
renderer.Render (CRenderDC (&dcMem, nHeight, pDoc->m_pStyle), (RenderType) i, true);
}
m_bRedraw = false;
}
// draw the bitmaps
int x[] = {
(rect.Width () - rdc.GetWidth (Cover)) / 2 + 5,
(rect.Width () - rdc.GetWidth (Back)) / 2 + 5,
(rect.Width () - rdc.GetWidth (Inlay)) / 2 + 5,
(rect.Width () - rdc.GetWidth (Label)) / 2 + 5,
(rect.Width () - rdc.GetWidth (Cover)) / 2 + 5
};
//.........这里部分代码省略.........
示例5: DrawBackground
void CDepartmentEstimationDialog::DrawBackground(CPaintDC &dc)
{
CBrush brush(RGB(200,200,200));
dc.FillRect(m_CanvasRect, &brush);
brush.DeleteObject();
}
示例6: GetRedValue
////////////////////////////////////////////////////////////////////////////////
//#include "../../../code/image_proc/image/hsi.hpp"
bool
CColorAdjustDialog::DrawPreview(CPaintDC& dc, RECT* rect)
{
if (!m_blit_tile || m_blit_tile->GetPixels() == NULL || rect == NULL) {
return false;
}
/////////////////////////////////////////////////////////
const int width = m_blit_tile->GetWidth();
const int height = m_blit_tile->GetHeight();
int current_width = m_Width;
if (current_width > width)
current_width = width;
int current_height = m_Height;
if (current_height > height)
current_height = height;
BGRA* pixels = (BGRA*) m_blit_tile->GetPixels();
for (int iy = 0; iy < current_height; iy++) {
for (int ix = 0; ix < current_width; ix++) {
pixels[iy * width + ix].red = m_Pixels[iy * m_Width + ix].red;
pixels[iy * width + ix].green = m_Pixels[iy * m_Width + ix].green;
pixels[iy * width + ix].blue = m_Pixels[iy * m_Width + ix].blue;
pixels[iy * width + ix].alpha = m_Pixels[iy * m_Width + ix].alpha;
}
}
/////////////////////////////////////////////////////////
int red_value = GetRedValue();
int green_value = GetGreenValue();
int blue_value = GetBlueValue();
int alpha_value = GetAlphaValue();
int use_red = ShouldUseRedChannel();
int use_green = ShouldUseGreenChannel();
int use_blue = ShouldUseBlueChannel();
int use_alpha = ShouldUseAlphaChannel();
int method = 0;
if (method == 0)
{
for (int iy = 0; iy < current_height; iy++) {
for (int ix = 0; ix < current_width; ix++) {
if (use_red) pixels[iy * width + ix].red += red_value;
if (use_green) pixels[iy * width + ix].green += green_value;
if (use_blue) pixels[iy * width + ix].blue += blue_value;
if (use_alpha) pixels[iy * width + ix].alpha += alpha_value;
}
}
}
/*
else
{
double h_value = ((double)red_value / (double)255.0) * ((double)2.0 * 3.14);
double s_value = ((double)green_value / (double)255.0);
double i_value = ((double)blue_value / (double)255.0);
for (int iy = 0; iy < current_height; iy++) {
for (int ix = 0; ix < current_width; ix++) {
double r = pixels[iy * width + ix].red / 255.0;
double g = pixels[iy * width + ix].green / 255.0;
double b = pixels[iy * width + ix].blue / 255.0;
double h, s, i;
RGBtoHSI(r, g, b, &h, &s, &i);
if (use_red) h += h_value;
if (use_green) s += s_value;
if (use_blue) i += i_value;
if (use_alpha) pixels[iy * width + ix].alpha += alpha_value;
HSItoRGB(h, s, i, &r, &g, &b);
pixels[iy * width + ix].red = r * 255;
pixels[iy * width + ix].green = g * 255;
pixels[iy * width + ix].blue = b * 255;
}
}
}
*/
/////////////////////////////////////////////////////////
dc.BitBlt(rect->left, rect->top, current_width, current_height, CDC::FromHandle(m_blit_tile->GetDC()), 0, 0, SRCCOPY);
if (1) {
rect->left += current_width;
dc.FillRect(rect, CBrush::FromHandle((HBRUSH)GetStockObject(BLACK_BRUSH)));
rect->left -= current_width;
rect->top += current_height;
dc.FillRect(rect, CBrush::FromHandle((HBRUSH)GetStockObject(BLACK_BRUSH)));
rect->top -= current_height;
}
return true;
}