本文整理汇总了C++中Graphics::FillRectangle方法的典型用法代码示例。如果您正苦于以下问题:C++ Graphics::FillRectangle方法的具体用法?C++ Graphics::FillRectangle怎么用?C++ Graphics::FillRectangle使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Graphics
的用法示例。
在下文中一共展示了Graphics::FillRectangle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnDraw
HRESULT CIGFrameControl::OnDraw(ATL_DRAWINFO& di)
{
if (!m_spFrame)
return S_OK;
m_spFrame->Render (di.hdcDraw);
RECT& rc = *(RECT*)di.prcBounds;
Graphics graphics (di.hdcDraw);
int nFramePosX = 0;
int nFramePosY = 0;
int nFramePosWidth = 0;
int nFramePosHeight = 0;
m_spFrame->GetFramePos (nFramePosX, nFramePosY, nFramePosWidth, nFramePosHeight);
SolidBrush brushFrameOut (m_spFrame->GetSelected() ? IGFRAME_FRAMEOUT_SELECTED : IGFRAME_FRAMEOUT);
graphics.FillRectangle (&brushFrameOut, Rect (2, 2,
rc.right - rc.left - 4, nFramePosY - 2));
graphics.FillRectangle (&brushFrameOut, Rect (2, nFramePosY,
nFramePosX - 2, rc.bottom - rc.top - nFramePosY - 2));
graphics.FillRectangle (&brushFrameOut, Rect (nFramePosX, nFramePosY + nFramePosHeight,
nFramePosWidth, rc.bottom - rc.top - (nFramePosY + nFramePosHeight) - 2));
graphics.FillRectangle (&brushFrameOut, Rect (nFramePosX + nFramePosWidth, nFramePosY,
rc.right - rc.left - (nFramePosX + nFramePosWidth) - 2, rc.bottom - rc.top - nFramePosY - 2));
Pen penFrameBorder (IGFRAME_FRAMEBORDER, 1);
graphics.DrawRectangle (&penFrameBorder, Rect (nFramePosX - 1, nFramePosY - 1,
nFramePosWidth + 1, nFramePosHeight + 1));
Pen penIn (m_spFrame->GetSelected() ? IGFRAME_BORDER_SELECTED : IGFRAME_BORDER_INCOLOR, 1);
Pen penOut (m_spFrame->GetSelected() ? IGFRAME_BORDER_SELECTED : IGFRAME_BORDER_OUTCOLOR, 1);
graphics.DrawRectangle (&penOut, Rect (0, 0,
rc.right - rc.left - 1, rc.bottom - rc.top - 1));
graphics.DrawRectangle (&penIn, Rect (1, 1,
rc.right - rc.left - 3, rc.bottom - rc.top - 3));
return S_OK;
}
示例2: drawButton
void CIGWorkspaceButtonPanel::drawButton (HWND hWnd, HDC hDC, IGLibrary::IGFrame *pCxButtonIcon)
{
if (pCxButtonIcon)
{
pCxButtonIcon->LayerDrawAllInClearedCache (hDC, 0, 0, -1, -1, 0, false, false, false, RGB (0, 0, 0));
// test if mouse is over the current button
if ((m_eButtonState == IGBUTTON_MOUSEOVER)
&& (hWnd == m_hOverButton))
{
Graphics graphics (hDC);
int nButtonSize = pCxButtonIcon->GetWidth();
Rect rcGdiButton = Rect (0, 0,
nButtonSize - 1,
nButtonSize - 1);
// draw blue square in mouseover mode
SolidBrush solBrushButton (IGWORKSPACE_COLOR_BUTTON);
graphics.FillRectangle (&solBrushButton, rcGdiButton);
Pen penButtonBorder (IGWORKSPACE_COLOR_BUTTONBORDER);
graphics.DrawRectangle (&penButtonBorder, rcGdiButton);
}
// draw button icon
if (m_eButtonState == IGBUTTON_MOUSEOVER)
pCxButtonIcon->LayerDrawAllFromCache (hDC, 0, 0, IGWORKSPACEBUTTONPANEL_ALPHAOVER, RGB (0, 0, 0));
else
pCxButtonIcon->LayerDrawAllFromCache (hDC, 0, 0, IGWORKSPACEBUTTONPANEL_ALPHANORMAL, RGB (0, 0, 0));
}
}
示例3: f
static void DrawFrame2(Graphics &g, RectI r)
{
g.SetCompositingQuality(CompositingQualityHighQuality);
g.SetSmoothingMode(SmoothingModeAntiAlias);
g.SetPageUnit(UnitPixel);
Font f(L"Impact", 40, FontStyleRegular);
CalcLettersLayout(g, &f, r.dx);
SolidBrush bgBrush(Color(0xff, 0xf2, 0));
Rect r2(r.ToGdipRect());
r2.Inflate(1, 1);
g.FillRectangle(&bgBrush, r2);
Font f2(L"Impact", 16, FontStyleRegular);
DrawSumatraLetters(g, &f, &f2, 18.f);
if (gShowOptions)
return;
REAL msgY = (REAL)(r.dy / 2);
if (gMsg)
msgY += DrawMessage(g, gMsg, msgY, (REAL)r.dx, gMsgColor) + 5;
if (gMsgError)
DrawMessage(g, gMsgError, msgY, (REAL)r.dx, COLOR_MSG_FAILED);
}
示例4: gradationCenter
void CAguraDlgBlue::gradationCenter(Graphics& g, CRect rt, Color& color1, Color& color2, BOOL bLine, Color& color3)
{
GraphicsPath gPath;
int iHeight = rt.Width() / 4;
int iWidth = rt.Width() / 4;
RectF rtF((REAL)rt.left - iWidth, (REAL)rt.top - iHeight, (REAL)rt.Width() + iWidth * 2, (REAL)rt.Height() + iHeight * 2);
gPath.AddEllipse(rtF);
gPath.CloseFigure();
PathGradientBrush PGB(&gPath);
PGB.SetCenterColor(color1); //would be some shade of blue, following your example
int colCount = 1;
PGB.SetSurroundColors(&color2, &colCount); //same as your center color, but with the alpha channel set to 0
//play with these numbers to get the glow effect you want
REAL blendFactors[] = {0.0f, 0.1f, 0.3f, 1.0f};
REAL blendPos[] = {0.0f, 0.4f, 0.6f, 1.0f};
//sets how transition toward the center is shaped
PGB.SetBlend(blendFactors, blendPos, 4);
//sets the scaling on the center. you may want to have it elongated in the x-direction
PGB.SetFocusScales(0.2f, 0.2f);
RectF rtDraw((REAL)rt.left, (REAL)rt.top, (REAL)rt.Width(), (REAL)rt.Height());
g.FillRectangle(&PGB, rtDraw);
if (bLine == TRUE)
{
Pen pen(color3, 1);
g.DrawRectangle(&pen, rtDraw);
}
}
示例5: while
void
MFCInstanceView::Draw(Graphics &dc, CRect &clipBox)
{
// !!!??? need to clip properly for short instances with long names
Pen blackPen(AlphaColor(250, rgb_black), 1);
Pen redPen(AlphaColor(250, rgb_red), 1);
SolidBrush blueBrush(AlphaColor(100, rgb_blue));
SolidBrush blackBrush(AlphaColor(100, rgb_black));
CRect clipBounds = bounds;
if (clipBox.left > bounds.left) clipBounds.left = clipBox.left-1;
if (clipBox.right < bounds.right) clipBounds.right = clipBox.right+1;
cerr << "ondraw instance view " << clipBox.left << ", " << clipBox.right << endl;
dc.FillRectangle(&blueBrush,
bounds.left, bounds.top, bounds.right-bounds.left, bounds.bottom-bounds.top);
dc.DrawRectangle(selected?&redPen:&blackPen,
bounds.left, bounds.top, clipBounds.right-bounds.left, bounds.bottom-bounds.top);
Font labelFont(L"Arial", 8.0, FontStyleRegular, UnitPoint, NULL);
wstring nm;
const char *cp = instance->sym->uniqueName();
while (*cp) { nm.push_back(*cp++); }
float lbx = bounds.left+2;
#define LBLSEP 200
if (clipBox.left > lbx) {
int nld = clipBox.left - lbx;
nld = nld/LBLSEP;
// if (nld > 2) lbx += (nld-2)*LBLSEP;
}
PointF p(lbx, clipBounds.top);
do {
dc.DrawString(nm.c_str(), -1, &labelFont, p, &blackBrush);
p.X += LBLSEP;
} while (p.X < clipBounds.right);
}
示例6: drawOnNativeGdi
//原生GDI+ 绘制
void converDemo::drawOnNativeGdi(Graphics &graphics)
{
GraphicsPath path;
path.AddEllipse(10, 10, 100, 100);
path.AddRectangle(RectF(100, 100, 200, 250));
PathGradientBrush* brush = new PathGradientBrush(&path);
Color colors[] = {
Color(0, 0, 255), Color(0, 0, 0), Color(0, 255, 0), Color(255, 0, 0)
};
REAL reals[] = {
0, 0.5, 0.8, 1
};
brush->SetInterpolationColors(colors, reals, 4);
Matrix matrix;
matrix.Translate(100, 0);
matrix.Shear(0.15, 0.3);
matrix.Scale(0.4, 0.2);
matrix.Rotate(0.5);
// brush->MultiplyTransform(&matrix, MatrixOrderAppend);
RectF rect(convertQRectF2GpRectF(QRectF(100.0f, 100.0f, 200.0f, 400.0f)));
graphics.FillRectangle(brush, rect);
delete brush;
}
示例7: Layer
Gridlay::Gridlay(ChildCore *core) : Layer(core,NULL)
{
this->image = NULL;
this->gridblock = NULL;
this->pattern = NULL;
this->x = 0;
this->y = 0;
this->oldx = 0;
this->oldy = 0;
this->width = 0;
this->height = 0;
this->rendered = false;
SolidBrush *b = new SolidBrush(CLR_FRAME_LIGHT);
this->image = new Bitmap(2 * GRDBGBLOCK,2 * GRDBGBLOCK,Core::getPixelFormat());
Graphics *g = Graphics::FromImage(this->image);
g->SetInterpolationMode(InterpolationModeNearestNeighbor);
g->Clear(CLR_WHITE);
g->FillRectangle(b,GRDBGBLOCK,0,GRDBGBLOCK,GRDBGBLOCK);
g->FillRectangle(b,0,GRDBGBLOCK,GRDBGBLOCK,GRDBGBLOCK);
delete b;
delete g;
g = Graphics::FromHWND(this->core->getWindowHandle());
this->pattern = new CachedBitmap((Bitmap *)this->image,g);
delete g;
}
示例8: OnPaint
void DrawItemManagement::OnPaint(Graphics& g)
{
//»±³¾°É«
g.FillRectangle(&SolidBrush(m_backgroundColor),getDrawRectF());
m_strategy->OnPaint(g,m_allDrawItemList);
}
示例9: OnPaint
void PlayControlWnd::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CWnd::OnPaint() for painting messages
Graphics graphics(dc.m_hDC);
CRect rect;
GetClientRect(&rect);
Bitmap bmp(rect.right,rect.bottom);
Graphics* memGraph = Graphics::FromImage(&bmp);
SolidBrush brushBg(Color::Black);
memGraph->FillRectangle(
&brushBg,
rect.left,
rect.top,
rect.Width(),
rect.Height()
);
graphics.DrawImage(&bmp,rect.left,rect.top,rect.right,rect.bottom);
delete memGraph;
}
示例10: drawOnTranslateQT
//QT转成GDI+绘制
void converDemo::drawOnTranslateQT(Graphics &graphics)
{
Color color;
QColor qcolor(100, 210, 207.5, 100);
convertQColor2GpColor(qcolor, &color);
RectF rect(convertQRectF2GpRectF(QRectF(0.0f, 0.0f, 200.0f, 400.0f)));
Brush* brush = convertQBrush2GpBrush(newPathGradientBrush());
graphics.FillRectangle(brush, rect);
delete brush;
brush = convertQBrush2GpBrush(creatQTextureBrush());
// Image* image = ((TextureBrush*)brush)->GetImage();
// graphics.DrawImage(image, 0, 0, image->GetWidth(), image->GetHeight());
graphics.FillRectangle(brush, RectF(0, 200, 100, 400));
delete brush;
}
示例11: DrawBackground
void CIGPropertyManager::DrawBackground (const RECT& rcWnd, Graphics& graphics)
{
static SolidBrush backgroundBrush (IGPROPERTYMANAGER_COLOR_BACKGROUND);
Rect rectBackgroundItem (0, 0,
rcWnd.right - rcWnd.left - 1, rcWnd.bottom - rcWnd.top - 1);
graphics.FillRectangle (&backgroundBrush, rectBackgroundItem);
Pen penBorder (IGPROPERTYMANAGER_COLOR_BORDER);
graphics.DrawRectangle (&penBorder, rectBackgroundItem);
}
示例12: Draw
void CRectView::Draw(CDC* pDC, const std::vector<CElement*>& selection, CElement* highlight)
{
Pen pen(ColorToDraw(selection, highlight), penWidth);
SolidBrush brush(fillColor);
Graphics g = pDC->GetSafeHdc();
g.FillRectangle(&brush, *this);
g.DrawRectangle(&pen, *this);
}
示例13: DoPaint
void CMainDlg::DoPaint(Graphics& g)
{
CRect rcClient;
GetClientRect(&rcClient);
Rect rc(rcClient.left, rcClient.top, rcClient.Width(), rcClient.Height());
SolidBrush br(Color::WhiteSmoke);
g.FillRectangle(&br, rc);
}
示例14: DrawZone
void CZoneView::DrawZone(CDC* pDC, const std::vector<CElement*>& selection, CElement* highlight) const
{
Graphics g = pDC->GetSafeHdc();
Pen pen(ColorToDraw(selection, highlight), 1);
//Arrondir les angles avec GDI+, possible ?
SolidBrush brush(Color::MakeARGB(100, fillColor.GetR(), fillColor.GetG(), fillColor.GetB()));
Rect visibleRect(*this);
visibleRect.Inflate(-3, -3);
g.FillRectangle(&brush, visibleRect);
g.DrawRectangle(&pen, visibleRect);
}
示例15: DrawGradient
/**
* Draws a gradient filling the rectangle specified by r
* in direction of nAngle (which is specified in tenth of degrees)
* using a linear shading from color crStart to crEnd
*/
void CGradientRenderer::DrawGradient(CDC* pDC, HANDLE hndPrinter, CRect r, int nAngle, COLORREF crStart, COLORREF crEnd, CPreviewDC* pDCPreview)
{
Graphics graphics (pDC->GetSafeHdc (), hndPrinter);
graphics.SetPageUnit (UnitPixel);
graphics.SetSmoothingMode (SmoothingModeHighQuality);
graphics.SetInterpolationMode (InterpolationModeHighQualityBicubic);
graphics.SetPixelOffsetMode (PixelOffsetModeHighQuality);
Brush* pBrush = CGradient::CreateLinearGradientBrush (r, deg2rad (nAngle), crStart, crEnd);
graphics.FillRectangle (pBrush, r.left, r.top, r.Width (), r.Height ());
}