⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 textimagesoundcontainer.cpp

📁 基于Symbian OS的手机开发与应用:第10章基本图形声音习题源程序。
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CTextImageSoundContainer from TextImageSoundContainer.h
*  Part of  : TextImageSound
*  Created  : 2006-4-22 by LiuLiping
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: 
* ============================================================================
*/

// INCLUDE FILES
#include "TextImageSoundContainer.h"
#include <stringloader.h>
#include <gdi.h>
#include <eikenv.h>		//CEikonEnv
#include <textimagesound.rsg>

const TInt KColorOrange = 23;
const TInt KColorBlue = 210;
// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CTextImageSoundContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CTextImageSoundContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();
    SetRect(aRect);
    ActivateL();
    }

// Destructor
CTextImageSoundContainer::~CTextImageSoundContainer()
    {
    }

// ---------------------------------------------------------
// CTextImageSoundContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CTextImageSoundContainer::SizeChanged()
    {
    // TODO: Add here control resize code etc.
    }
// ---------------------------------------------------------
// CTextImageSoundContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CTextImageSoundContainer::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    // TODO: Add your drawing code here
    // example code...
	gc.Clear(aRect);

	//画半圆
	TRect pieRect;				
	TPoint CenterPoint=aRect.Center();
	pieRect.iTl=TPoint(20,20);	
	pieRect.iBr=TPoint (aRect.iBr.iX-20,aRect.iBr.iY-20);	
	TPoint pieStart=TPoint(0,CenterPoint.iY);					
    TPoint pieEnd=TPoint(aRect.iBr.iX,CenterPoint.iY);					
	gc.SetBrushColor(KColorBlue);
	gc.DrawPie(pieRect,pieStart,pieEnd);

    //画文本
	TRgb colorRed=AKN_LAF_COLOR(KColorOrange);
    gc.SetPenStyle( CGraphicsContext::ENullPen );
    gc.SetPenColor( KColorBlue );
	gc.SetBrushStyle( CGraphicsContext::ESolidBrush );
    TPoint textPoint(aRect.Width()/5,aRect.Height()/2);
	TBuf<20> text;
	StringLoader::Load(text,R_APP_TEXT);
	const CFont* normalFont=iEikonEnv->NormalFont();
	gc.UseFont(normalFont);								
	gc.DrawText(text,textPoint);						
    gc.DiscardFont();
    }

// ---------------------------------------------------------
// CTextImageSoundContainer::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CTextImageSoundContainer::HandleControlEventL(
    CCoeControl* /*aControl*/,TCoeEvent /*aEventType*/)
    {
    // TODO: Add your control event handler code here
    }


// End of File  

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -