本文整理汇总了C++中CWindowGc::SetPenColor方法的典型用法代码示例。如果您正苦于以下问题:C++ CWindowGc::SetPenColor方法的具体用法?C++ CWindowGc::SetPenColor怎么用?C++ CWindowGc::SetPenColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CWindowGc
的用法示例。
在下文中一共展示了CWindowGc::SetPenColor方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DrawTitlePaneJoint
/**
* Draws the joints between menu pane and menu pane title into the graphics
* context aGc, in the rectangle aRect.
*/
EXPORT_C void LafMenuPane::DrawTitlePaneJoint(const MLafEnv& aLafEnv, const CCoeControl& aMenuPane, CWindowGc& aGc, const CCoeControl* aMenuPaneTitle, const TRect& aInnerRect)
{
PrepareGcForDrawingItems(aLafEnv, aMenuPane, aGc);
aGc.SetPenStyle(CGraphicsContext::ENullPen);
aGc.DrawRect(aInnerRect);
if (aMenuPaneTitle)
{// pane has title, so make sure they are joined up correctly
const TPoint titlePos = aMenuPaneTitle->Position();
const TInt width = aMenuPaneTitle->Size().iWidth;
const TPoint position = aMenuPane.Position();
// left straight join
aGc.SetPenStyle(CGraphicsContext::ESolidPen);
aGc.SetPenColor(aLafEnv.ControlColor(EColorMenuPaneBackground, aMenuPane));
// get rid of the gray bit of border
aGc.DrawLine(TPoint(titlePos.iX-position.iX+5,4),TPoint(titlePos.iX-position.iX+width-5,4));
// get rid of the black bit of border
aGc.DrawLine(TPoint(titlePos.iX-position.iX+4,0),TPoint(titlePos.iX-position.iX+width-4,0));
aGc.DrawLine(TPoint(titlePos.iX-position.iX+4,1),TPoint(titlePos.iX-position.iX+width-4,1));
aGc.DrawLine(TPoint(titlePos.iX-position.iX+5,4),TPoint(titlePos.iX-position.iX+width-5,4));
aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,0),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),0));
aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,1),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),1));
aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,2),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),2));
aGc.DrawLine(TPoint(titlePos.iX-position.iX+MenuPaneSeparatorMargin() ,3),TPoint(titlePos.iX-position.iX+width-MenuPaneSeparatorMargin(),3));
// draw in black line seperator
aGc.SetPenColor(KRgbBlack);
aGc.DrawLine(TPoint(titlePos.iX-position.iX +MenuPaneSeparatorMargin(),0),TPoint(titlePos.iX-position.iX+width-3-MenuPaneSeparatorMargin(),0));
TGulBorder::TColors borderColors;
GetBorderColors(borderColors, aLafEnv, *aMenuPaneTitle);
aGc.SetPenColor(borderColors.iMidlight);
aGc.DrawLine(TPoint(titlePos.iX-position.iX+1,0),TPoint(titlePos.iX-position.iX+4,0));
aGc.DrawLine(TPoint(titlePos.iX-position.iX+1,1),TPoint(titlePos.iX-position.iX+4,1));
if (aMenuPaneTitle->Rect().iBr.iX==aMenuPane.Rect().iBr.iX)
{// right straight join
aGc.SetPenColor(borderColors.iMid);
aGc.DrawLine(TPoint(aInnerRect.iBr.iX,0),TPoint(aInnerRect.iBr.iX,5));
aGc.DrawLine(TPoint(aInnerRect.iBr.iX+1,0),TPoint(aInnerRect.iBr.iX+1,4));
aGc.DrawLine(TPoint(aInnerRect.iBr.iX+2,0),TPoint(aInnerRect.iBr.iX+2,3));
}
else
{// right corner join
TInt xPos=titlePos.iX-position.iX+width-4;
aGc.SetPenColor(borderColors.iMid);
aGc.DrawLine(TPoint(xPos,0),TPoint(xPos,4));
aGc.DrawLine(TPoint(xPos+1,0),TPoint(xPos+1,3));
aGc.DrawLine(TPoint(xPos+2,0),TPoint(xPos+2,2));
}
}
}
示例2: 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);
}
示例3: DrawCurrentDay
void CCalendarManagerContainer::DrawCurrentDay(CWindowGc& gc, MAknsSkinInstance* p_BgSkin, const TRgb& p_Default_Select_Color, const CFont& p_Font) const
{
TInt i_Col = (g_CalendarClass->g_SelectDay + g_CalendarClass->g_FirstWeek - 1) % 7 + 2;
TInt i_Row = (g_CalendarClass->g_SelectDay + g_CalendarClass->g_FirstWeek - 1) / 7 + 1;
TInt i_Pos_X = (i_Col - 1) * g_Space_X + i_Col - 1;
TInt i_Pos_Y = (i_Row - 1) * g_Space_Y + (i_Row - 1) * 2 + g_Pos_Y;
TRect i_OuterRect(i_Pos_X, i_Pos_Y, i_Pos_X + g_Space_X + 1, i_Pos_Y + g_Space_Y + 2);
i_OuterRect.Shrink(2, 2);
TRect i_InnerRect(i_OuterRect);
i_InnerRect.Shrink(4, 4);
AknsDrawUtils::DrawFrame(p_BgSkin, gc, i_OuterRect, i_InnerRect, KAknsIIDQsnFrList, KAknsIIDQsnFrListCenter);
gc.SetPenColor(p_Default_Select_Color);
TBuf<5> i_Num;
i_Num.AppendNum(g_CalendarClass->g_SelectDay);
if (g_CalendarClass->g_SelectYear == g_CalendarClass->g_Year && g_CalendarClass->g_SelectMonth == g_CalendarClass->g_Month && g_CalendarClass->g_SelectDay == g_CalendarClass->g_Day)
gc.SetUnderlineStyle(EUnderlineOn);
else
gc.SetUnderlineStyle(EUnderlineOff);
gc.DrawText(i_Num, TRect(i_Pos_X, i_Pos_Y, i_Pos_X + g_Space_X, i_Pos_Y + g_Space_Y), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels() + 1, CGraphicsContext::ECenter, 0);
}
示例4: DrawVisualFeedback
/**
* Draws visual feedback for a menu item to indicate that it has been selected. This is shown for
* the brief interval between the item being selected and the menu being dismissed. Uses the
* environment aLafEnv for setting up the context aGc for the menu pane aMenuPane and draws inside
* the item rectangle aRect.
*
* @since App-Framework_6.1
*/
EXPORT_C void LafMenuPane::DrawVisualFeedback(const MLafEnv& /*aLafEnv*/, const CCoeControl& /*aMenuPane*/,
CWindowGc& aGc, const TRect& aRect)
{
aGc.SetPenColor(KRgbBlack);
aGc.SetBrushStyle(CGraphicsContext::ENullBrush);
aGc.DrawRect(aRect);
}
示例5: DrawFace
void CSmiley::DrawFace(CWindowGc &aGc) const
{
// Draw the smiley face, smiling or looking sad
aGc.SetPenColor(KRgbBlack);
// Draw a circle for the face
aGc.DrawEllipse(iSmileyRect);
}
示例6: 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));
}
示例7: WriteName
/**
Writes the text "aText" on the control.\n
Sets the font,pen colour,brush style used for writing the text.\n
Draws the text uisng Draw Text function of Graphics context.\n
*/
void CCtlBase::WriteName( CWindowGc& aGc, const TDesC& aText ) const
{
TRect rect = Rect() ;
rect.Shrink( 3, 3 ) ;
aGc.UseFont( iFont ) ;
TInt ascent = ( rect.iBr.iY - rect.iTl.iY-iFont->HeightInPixels() ) / 2 + iFont->AscentInPixels() ;
aGc.SetPenColor( KRgbBlack ) ;
aGc.SetBrushStyle( CGraphicsContext::ESolidBrush ) ;
aGc.DrawText( aText, rect, ascent, CGraphicsContext::ECenter ) ;
}
示例8: DrawTexts
void CZXingBarcodeReaderAppView::DrawTexts(CWindowGc& gc) const
{
if (iTitle.Length()>0)
{
TRect rect(Rect());
gc.SetPenColor(KRgbWhite);
gc.UseFont(iTitleFont);
gc.DrawText(iTitle, rect, rect.Height()/10, CGraphicsContext::ECenter );
gc.DiscardFont();
}
}
示例9: PrepareContext
/** Prepares the graphics context for drawing the control in its normal state.
The function uses the brush and pen properties which have been set, or uses
a black pen and a black solid brush by default. When a bitmap has been set
a patterned style brush is selected
@param aGc The window graphics context. */
EXPORT_C void CCoeBrushAndPenContext::PrepareContext(CWindowGc& aGc) const
{
if (iBitmap)
{
aGc.UseBrushPattern(iBitmap);
aGc.SetBrushStyle(CGraphicsContext::EPatternedBrush);
return;
}
aGc.SetBrushStyle(iBrushStyle);
aGc.SetBrushColor(iBrushColor);
aGc.SetPenColor(iPenColor);
}
示例10: DrawMouth
void CSmiley::DrawMouth(CWindowGc& aGc, TBool bSmiling) const
{
aGc.SetPenColor(KRgbBlack);
if (bSmiling)
{
aGc.DrawArc(iSmileRect,
iSmileRect.iTl + TPoint(0, iSmileRect.Height() / 2),
iSmileRect.iTl + TPoint(iSmileyWidth / 2, iSmileRect.Height() / 2));
}
else
{
aGc.DrawArc(iFrownRect,
iFrownRect.iTl + TPoint(iSmileyWidth / 2, iFrownRect.Height() / 2),
iFrownRect.iTl + TPoint(0, iFrownRect.Height() / 2));
}
}
示例11: DrawWeek
void CCalendarManagerContainer::DrawWeek(CWindowGc& gc, const TRect& aRect, const TRgb& p_Default_Font_Color1, const CFont& p_Font) const
{
gc.SetPenColor(p_Default_Font_Color1);
gc.SetUnderlineStyle(EUnderlineOff);
TInt i_Pos_X = 0;
TInt i_Pos_Y = g_Pos_Y;
for (TInt i = 0;i < sizeof(g_CalendarClass->g_Week) / sizeof(TInt);i++)
{
TBuf<10> i_Num;
i_Num.AppendNum(g_CalendarClass->g_Week[i]);
gc.DrawText(i_Num, TRect(i_Pos_X, i_Pos_Y, i_Pos_X + g_Space_X, i_Pos_Y + g_Space_Y), (g_Space_Y - p_Font.HeightInPixels()) / 2 + p_Font.HeightInPixels() + 1, CGraphicsContext::ECenter, 0);
i_Pos_Y += g_Space_Y + 2;
}
}
示例12: DrawEyebrow
void CSmiley::DrawEyebrow(CWindowGc & aGc, TBool bSmiling) const
{
//Draw the mouth, smiling or looking sad.
aGc.SetPenSize(TSize(1, 1));
aGc.SetPenColor(KRgbWhite);
if (bSmiling)
{
aGc.DrawArc(iFrownRect,
iFrownRect.iTl + TPoint(iSmileyWidth / 2, iFrownRect.Height() / 2),
iFrownRect.iTl + TPoint(0, iFrownRect.Height() / 2));
}
else
{
aGc.DrawArc(iSmileRect,
iSmileRect.iTl + TPoint(0, iSmileRect.Height() / 2),
iSmileRect.iTl + TPoint(iSmileyWidth / 2, iSmileRect.Height() / 2));
}
}
示例13: DrawQuitCommand
void CSpaceInvadersAppView::DrawQuitCommand(CWindowGc& aGc) const
{
TRgb pencolor = TRgb(255,255,255);
aGc.SetPenColor(pencolor);
_LIT(KQuitText, "Quit");
TBufC<4> quitText;
TPtr quitPtr = quitText.Des();
quitPtr.Append(KQuitText);
const CFont* menuFont =
AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont, NULL);
aGc.UseFont(menuFont);
TInt textLength = menuFont->TextWidthInPixels(quitPtr);
TInt textHeight = menuFont->HeightInPixels();
TPoint textpoint(Rect().Width() - ( textLength + 10 ),
Rect().Height() - textHeight);
aGc.DrawText(quitPtr, textpoint);
}
示例14: DrawPoints
void CSpaceInvadersAppView::DrawPoints(CWindowGc& aGc) const
{
TRgb pencolor = TRgb(255,255,255);
aGc.SetPenColor(pencolor);
_LIT(KPointsText, "Points: ");
TBufC<15> pointsText;
TPtr pointsPtr = pointsText.Des();
pointsPtr.Append(KPointsText);
pointsPtr.AppendNum(iHolder->ActivePoints());
const CFont* menuFont =
AknLayoutUtils::FontFromId(EAknLogicalFontPrimarySmallFont, NULL);
aGc.UseFont(menuFont);
TInt textLength = menuFont->TextWidthInPixels(pointsPtr);
TInt textHeight = menuFont->HeightInPixels();
TPoint textpoint(Rect().Width() / 2 - textLength / 2, textHeight);
aGc.DrawText(pointsPtr, textpoint);
}
示例15: HandlePointerMoveBufferReady
void CMainWindow::HandlePointerMoveBufferReady()
{
TPoint pnts[KPointerMoveBufferSize];
TPtr8 ptr((TUint8 *) &pnts, sizeof(pnts));
TInt numPnts = Window().RetrievePointerMoveBuffer(ptr);
TRect redrawRect(Window().Position(), Window().Size());
CWindowGc* gc = SystemGc();
gc->Activate(Window());
gc->SetPenColor(KRgbBlue);
gc->SetPenSize(TSize(2, 2));
Window().Invalidate();
Window().BeginRedraw(redrawRect); // N.B. Redrawer::RunL() gets called with this
// rectangle - must give it a non-zero value
for (TInt index = 0; index < numPnts; index++)
{
gc->DrawLineTo(pnts[index]);
}
Window().EndRedraw();
gc->Deactivate();
}