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();
		}
		}
void CMultiPtrTestChildControl::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::ELeft );	
	aGc.DiscardFont();
	}
Exemplo n.º 3
0
/****************************************************************************\
|	Function:	CNumberedWindow::Draw
 |	Purpose:	Redraws the contents of CNumberedWindow within a given
 |				rectangle.  CNumberedWindow displays a number in the window.
 |	Input:		aRect	Rectangle that needs redrawing
 |	Output:		None
 \****************************************************************************/
void CNumberedWindow::Draw(const TRect& aRect)
    {
    const TBufC<1> strings[5] =
        {
        *&KString1, *&KString2, *&KString3, *&KString4, *&KString5
        };

    CWindowGc* gc = SystemGc(); // get a graphics context
    gc->SetClippingRect(aRect); // clip outside the redraw area
    gc->Clear(aRect); // clear the redraw area
    TSize size = iWindow.Size();
    TInt height = size.iHeight; // Need window height to calculate vertical text offset
    TInt ascent = Font()->AscentInPixels();
    TInt descent = Font()->DescentInPixels();
    TInt offset = (height + (ascent + descent)) / 2; // Calculate vertical text offset
    gc->SetPenColor(TRgb(0, 0, 0)); // Set pen to black
    gc->UseFont(Font());
    gc->DrawText(strings[iNumber], TRect(TPoint(0, 0), size), offset,
            CGraphicsContext::ECenter);
    gc->DiscardFont();
    }