当前位置: 首页>>代码示例>>C++>>正文


C++ Graphics::FillRectangle方法代码示例

本文整理汇总了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;
}
开发者ID:Bitlsoft,项目名称:Imagenius_SDK,代码行数:32,代码来源:IGFrameControl.cpp

示例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));
	}
}
开发者ID:Bitlsoft,项目名称:Imagenius_SDK,代码行数:29,代码来源:IGWorkspace_ButtonPanel.cpp

示例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);
}
开发者ID:qingzhengzhuma,项目名称:sumatrapdf,代码行数:26,代码来源:Installer.cpp

示例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);
	}
}
开发者ID:siprikorea,项目名称:framework,代码行数:33,代码来源:AguraDlgBlue.cpp

示例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);
}
开发者ID:dakyri,项目名称:qua,代码行数:35,代码来源:MFCArrangeView.cpp

示例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;

}
开发者ID:huangchuqiang,项目名称:converDemo,代码行数:26,代码来源:converdemo.cpp

示例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;
}
开发者ID:f055,项目名称:fedit-image-editor,代码行数:31,代码来源:Layer_Gridlay.cpp

示例8: OnPaint

void DrawItemManagement::OnPaint(Graphics& g)
{
	//»­±³¾°É«
	g.FillRectangle(&SolidBrush(m_backgroundColor),getDrawRectF());

	m_strategy->OnPaint(g,m_allDrawItemList);
}
开发者ID:jzaicn,项目名称:DrawTools,代码行数:7,代码来源:DrawItemManagement.cpp

示例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;
}
开发者ID:PaulJing,项目名称:Sora,代码行数:26,代码来源:PlayControlWnd.cpp

示例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;
}
开发者ID:huangchuqiang,项目名称:converDemo,代码行数:18,代码来源:converdemo.cpp

示例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);
}
开发者ID:Bitlsoft,项目名称:Imagenius_SDK,代码行数:9,代码来源:IGPropertyManager.cpp

示例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);
}
开发者ID:hlobit,项目名称:SimPetri,代码行数:9,代码来源:RectView.cpp

示例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);
}
开发者ID:623442733,项目名称:CEFBrowser-1,代码行数:9,代码来源:MainDlg.cpp

示例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);
}
开发者ID:hlobit,项目名称:SimPetri,代码行数:11,代码来源:ZoneView.cpp

示例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 ());
}
开发者ID:matthias-christen,项目名称:CdCoverCreator,代码行数:16,代码来源:GradientRenderer.cpp


注:本文中的Graphics::FillRectangle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。