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


C++ CWindowGc::SetBrushColor方法代码示例

本文整理汇总了C++中CWindowGc::SetBrushColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CWindowGc::SetBrushColor方法的具体用法?C++ CWindowGc::SetBrushColor怎么用?C++ CWindowGc::SetBrushColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CWindowGc的用法示例。


在下文中一共展示了CWindowGc::SetBrushColor方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: PrepareGcForHighlight

/**
 * Prepares the graphics context aGc according of aHighlightType before drawing an item. At the
 * same time it determines and returns the text color to be used during the drawing of all components
 * of an item.
 */
EXPORT_C void LafMenuPane::PrepareGcForHighlight(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const TItemAttributes& aItemAttributes)
	{
	TRgb textColor = aLafEnv.ControlColor(EColorMenuPaneText, aMenuPane); //KEikMenuPaneTextColor;
	switch (aItemAttributes.iHighlightType)
		{
	case SLafMenuPane::EDrawHighlight:
		aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
		textColor = aLafEnv.ControlColor(EColorMenuPaneTextHighlight, aMenuPane);
		if (aMenuPane.IsFocused())
			{
			aGc.SetBrushColor(aLafEnv.ControlColor(EColorMenuPaneHighlight, aMenuPane));
			if (aItemAttributes.iFlags&EEikMenuItemDimmed)
				textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedTextHighlight, aMenuPane);
			}
		else
			{
			aGc.SetBrushColor(aLafEnv.ControlColor(EColorMenuPaneDimmedHighlight, aMenuPane));
			textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedTextHighlight, aMenuPane);
			}
		break;
	case SLafMenuPane::ERemoveHighlight:
	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
		if (aItemAttributes.iFlags&EEikMenuItemDimmed)
			textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedText, aMenuPane);
		break;
	case SLafMenuPane::ENoHighlight:
		aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
		if (aItemAttributes.iFlags&EEikMenuItemDimmed)
			textColor = aLafEnv.ControlColor(EColorMenuPaneDimmedText, aMenuPane);
		break;
	default:
		break;
		}
	aGc.SetPenColor(textColor);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:40,代码来源:LAFMENUP.CPP

示例2: Draw

//Background drawing function
void CTestRectGc::Draw(CWindowGc& aGc, const CCoeControl& aControl, const TRect& aRect) const
	{		
		if (iBmpBackground) 
		{
						
			TPoint a = PositionRelativeToScreen();
			TPoint b = aControl.PositionRelativeToScreen();

			//The source rect of the background is the relationship between this control and the control being drawn (child)
			//plus the subrect (aRect) to be drawn.
			TRect SourceRect(b-a+aRect.iTl, aRect.Size());

			aGc.SetDrawMode(CGraphicsContext::EDrawModePEN);
			aGc.BitBlt(aRect.iTl, iBmpBackground, SourceRect);			
			aGc.SetDrawMode(CGraphicsContext::EDrawModePEN);
		}
		else
		{
			TRect rc;
			aGc.SetClippingRect(aRect);
			aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
    		aGc.SetBrushColor(iBrushColor);
    		aGc.SetBrushStyle(iBrushStyle);
			aGc.DrawRect(rc);
			aGc.CancelClippingRect();

		}		
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:29,代码来源:TConeInvalidate.cpp

示例3:

/**
  Draw function of CConeBackgroundTestDrawer2 class used to draw the control.\n
  Sets the brush style to Solid Brush and Pen Style to Null Pen.\n
  Sets the brush colour to Blue and paints an ellipse on  the control.\n
*/
void CConeBackgroundTestDrawer2::Draw(CWindowGc& aGc, const CCoeControl& /*aControl*/, const TRect& aRect) const
	{
	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
	aGc.SetPenStyle(CGraphicsContext::ENullPen);
	aGc.SetBrushColor(TRgb(0x0000ff));
	aGc.DrawEllipse(aRect);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:12,代码来源:TConeBackground.cpp

示例4: PrepareGcForDrawingItems

/**
 * Prepares the graphics context aGc for drawing the items by setting the pen and brush.
 */
EXPORT_C void LafMenuPane::PrepareGcForDrawingItems(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc)
	{
	const CFont* font = NormalFont(aLafEnv);
	aGc.UseFont(font);
	aGc.SetPenColor(aLafEnv.ControlColor(EColorMenuPaneText, aMenuPane));
	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
	aGc.SetBrushColor(aLafEnv.ControlColor(EColorMenuPaneBackground, aMenuPane));
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:11,代码来源:LAFMENUP.CPP

示例5: PrepareContext

/** Sets the brush settings for the specified graphics context. 

If iBitmap is set, it sets this as the brush pattern and sets the brush style 
to EPatternedBrush. Otherwise, it sets the brush style and brush colour using 
the values of iBrushStyle and iBrushColor.

@param aGc The graphics context to set. */
EXPORT_C void MCoeControlBrushContext::PrepareContext(CWindowGc& aGc) const
	{
	if (iBitmap)
		{
		aGc.UseBrushPattern(iBitmap);
		aGc.SetBrushStyle(CGraphicsContext::EPatternedBrush);
		return;
		}
	aGc.SetBrushStyle(iBrushStyle);
	aGc.SetBrushColor(iBrushColor);
	}
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:18,代码来源:COECCNTX.CPP

示例6: DrawDragState

/**
 * Draws the thumb of the scrollbar. The thumb can be drawn in pressed colors if aIsDragged is true, or in normal
 * colors otherwise. The scrollbar is horizontal if aHorizontal is true and vertical otherwise.
 */
EXPORT_C void LafScrollThumb::DrawDragState(const MLafEnv& aLafEnv,CWindowGc& aGc,const CCoeControl& aScrollThumb,TBool aIsDragged, const TRect& aRect, TBool aHorizontal)
    {
    TRgb bgColor;
    if (aScrollThumb.IsDimmed())
        {
        bgColor=aLafEnv.ControlColor((aIsDragged? EColorScrollButtonThumbBackgroundPressed : EColorScrollThumbDimmed),aScrollThumb);
        }
    else
        {
        bgColor=aLafEnv.ControlColor((aIsDragged? EColorScrollButtonThumbBackgroundPressed : EColorScrollButtonThumbBackground),aScrollThumb);
        }
    
    aGc.SetBrushColor(bgColor);
    aGc.Clear(aRect);
    
    TRect gripRect=aRect;
    TInt length=(aHorizontal)? gripRect.Size().iWidth : gripRect.Size().iHeight;
    TInt gripStart=((length*(KLafScrollThumbGripProportion-1))/KLafScrollThumbGripProportion)/2;
    TInt horizBorder=(aHorizontal)? gripStart : KLafScrollThumbGripMargin;
    TInt vertBorder=(aHorizontal)? KLafScrollThumbGripMargin : gripStart;
    
    gripRect.Shrink(horizBorder,vertBorder);
    // TLafGrip::TOrientation gripOrientation=(aHorizontal)? TLafGrip::EVertical : TLafGrip::EHorizontal;
    }
开发者ID:cdaffara,项目名称:symbiandump-mw1,代码行数:28,代码来源:lafthumb.cpp

示例7: MainL

void MainL()	
	{	
	RWsSession ws;
	ws.Connect();
 	CWsScreenDevice* scr = new(ELeave) CWsScreenDevice(ws);
	scr->Construct();
 	CWindowGc* gc = new(ELeave) CWindowGc(scr);
	gc->Construct();
 	RWindowGroup grp(ws);
	grp.Construct(0xc0decafe, ETrue);
 	RWindow win(ws);
	win.Construct(grp, 0xbeefcafe);
	win.SetExtent(TPoint(20,160), TSize(320,240));
	win.Activate();
 	win.Invalidate();
	win.BeginRedraw();
	gc->Activate(win);
 	gc->SetPenStyle(CGraphicsContext::ENullPen);
	gc->SetBrushStyle(CGraphicsContext::ESolidBrush);
 	TBool color = EFalse;

if (Profiler::Start() == KErrNotFound)
	{
	_LIT(KProfiler,"profiler");
	_LIT(KStart,"start -noui -drive=S");
	RProcess p;
	if (p.Create(KProfiler,KStart) == KErrNone)
		{
		p.Resume();
		p.Close();
		}
	}

	for (TInt col=0; col<KCol; ++col)
		{
		color = !color;		
		for (TInt row=0; row<KRow; ++row)
			{
			TRect rect;
			rect.iTl.iX = col * KSize.iWidth;
			rect.iTl.iY = row * KSize.iHeight;
			rect.SetSize(KSize);
			color = !color;
			gc->SetBrushColor(color? KRgbBlue : KRgbBlack);
			gc->DrawRect(rect);
			}
	}
	
	
	
	gc->Deactivate();
	win.EndRedraw();
	ws.Flush();
 	User::After(3000000);
 	win.Close();
	grp.Close();
	delete gc;
	delete scr;
	ws.Close();

	Profiler::Stop();
	Profiler::Close();
	Profiler::Unload();

	} 
开发者ID:cdaffara,项目名称:symbian-oss_adapt,代码行数:65,代码来源:grid.cpp

示例8: DrawRectL

void CWelcomePageBase::DrawRectL(CWindowGc& aGc, const TRgb& aColor, const TJuikLayoutItem& aL) const
{
	aGc.SetBrushColor( aColor );
	aGc.DrawRect( aL.Rect() );	
}
开发者ID:flaithbheartaigh,项目名称:jaikuengine-mobile-client,代码行数:5,代码来源:cwu_welcomeviews.cpp

示例9: DrawBackground

void CSpaceInvadersAppView::DrawBackground(CWindowGc& aGc) const
{
    TRgb backcolor = TRgb(0,0,0);
    aGc.SetBrushColor(backcolor);
    aGc.Clear();
}
开发者ID:Watkinsong,项目名称:s6ace_invaders,代码行数:6,代码来源:SpaceInvadersAppView.cpp

示例10: PieDrawer

/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTraceContainer::PieDrawer(CWindowGc& aGc, TPoint aLeftTop, TInt aSize, TInt aProsentages, const TBool& aReverceColor) const
{
	TBuf<50> Buffer;
	Buffer.Num(aProsentages);
	Buffer.Append(_L("%"));

	aGc.SetPenColor(KRgbBlack);
	
	if(aReverceColor)
		aGc.SetBrushColor(KRgbGreen);
	else
		aGc.SetBrushColor(KRgbRed);
	
	aGc.SetBrushStyle(CGraphicsContext::ESolidBrush);
	aGc.DrawEllipse(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize));

	if(aProsentages < 0)
	{
		Buffer.Copy(_L("N/A"));
		
		if(aReverceColor)
			aGc.SetBrushColor(KRgbGreen);
		else
			aGc.SetBrushColor(KRgbRed);
	}
	else
	{
		TInt HelpPie = 0;
		
		if(aReverceColor)
			aGc.SetBrushColor(KRgbRed);
		else
			aGc.SetBrushColor(KRgbGreen);

		TInt Angle =((aProsentages * 360) / 100);

		if(Angle == 360)
		{
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),aLeftTop,aLeftTop);
		}
		else if(Angle == 45)
		{
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX,aLeftTop.iY));
		}
		else if(Angle == 135)
		{
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX,aLeftTop.iY + aSize));
		}
		else if(Angle == 225)
		{
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX + aSize,aLeftTop.iY + aSize));
		}
		else if(Angle == 315)
		{
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX + aSize,aLeftTop.iY));
		}
		else if(Angle > 45 && Angle < 135)
		{				
			HelpPie = ((((Angle - 45) * aSize) / 90) + aLeftTop.iY);
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX,HelpPie));
		}
		else if(Angle > 135 && Angle < 225)
		{
			HelpPie = ((((Angle - 135) * aSize) / 90) + aLeftTop.iX);
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(HelpPie,aLeftTop.iY + aSize));
		}
		else if(Angle > 225 && Angle < 315)
		{
			HelpPie = (((aLeftTop.iY + aSize) - ((Angle - 225) * aSize) / 90));
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(aLeftTop.iX + aSize,HelpPie));
		}
		else if(Angle > 0 && Angle < 45)
		{
			HelpPie = (((aLeftTop.iX + (aSize/2)) - ((Angle) * (aSize/2)) / 45));
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(HelpPie,aLeftTop.iY));
		}
		else if(Angle > 315 && Angle < 360)
		{
			HelpPie = (((aLeftTop.iX + aSize) - ((Angle - 315) * (aSize/2)) / 45));
			aGc.DrawPie(TRect(aLeftTop.iX,aLeftTop.iY,aLeftTop.iX + aSize,aLeftTop.iY + aSize),TPoint(aLeftTop.iX + (aSize/2),aLeftTop.iY),TPoint(HelpPie,aLeftTop.iY));
		}

		if(aReverceColor)
		{
			if(Angle > 180)
				aGc.SetBrushColor(KRgbGreen);
			else	
				aGc.SetBrushColor(KRgbRed);
		}
		else
		{
			if(Angle > 180)
				aGc.SetBrushColor(KRgbRed);
			else	
				aGc.SetBrushColor(KRgbGreen);
		}		
//.........这里部分代码省略.........
开发者ID:DrJukka,项目名称:Symbian_Codes,代码行数:101,代码来源:MainContainer.cpp


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