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

📄 basicdrawcontainer.cpp

📁 《基于symbian os 的手机开发与应用》 源代码 何伟 著
💻 CPP
字号:
/*
* ============================================================================
*  Name     : CBasicDrawContainer from BasicDrawContainer.h
*  Part of  : BasicDraw
*  Created  : 2006-4-15 by Hewei
*  Implementation notes:
*     Initial content was generated by Series 60 AppWizard.
*  Version  :
*  Copyright: Myself
* ============================================================================
*/

// INCLUDE FILES
#include "BasicDrawContainer.h"
#include <gdi.h>
#include <aknutils.h> 

const TInt KColorBlue=210;
const TInt KColorRed=35;
const TInt KColorGreen=185;
const TInt KColorYellow=5;

// ================= MEMBER FUNCTIONS =======================

// ---------------------------------------------------------
// CBasicDrawContainer::ConstructL(const TRect& aRect)
// EPOC two phased constructor
// ---------------------------------------------------------
//
void CBasicDrawContainer::ConstructL(const TRect& aRect)
    {
    CreateWindowL();

    SetRect(aRect);
    ActivateL();
    }

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

// ---------------------------------------------------------
// CBasicDrawContainer::SizeChanged()
// Called by framework when the view size is changed
// ---------------------------------------------------------
//
void CBasicDrawContainer::SizeChanged()
    {
    // TODO: Add here control resize code etc.
   
    }

// ---------------------------------------------------------
// CBasicDrawContainer::CountComponentControls() const
// ---------------------------------------------------------
//
TInt CBasicDrawContainer::CountComponentControls() const
    {
    return 0; // return nbr of controls inside this container
    }

// ---------------------------------------------------------
// CBasicDrawContainer::ComponentControl(TInt aIndex) const
// ---------------------------------------------------------
//
CCoeControl* CBasicDrawContainer::ComponentControl(TInt aIndex) const
    {
    switch ( aIndex )
        {
        case 0:
         
        default:
            return NULL;
        }
    }

// ---------------------------------------------------------
// CBasicDrawContainer::Draw(const TRect& aRect) const
// ---------------------------------------------------------
//
void CBasicDrawContainer::Draw(const TRect& aRect) const
    {
    CWindowGc& gc = SystemGc();
    gc.Clear( aRect );
	TPoint point1(10,10);
	TPoint point2(100,10);
	TSize PenSize(1,1);
	
	TRgb colorBlue=AKN_LAF_COLOR(KColorBlue);
	TRgb colorRed=AKN_LAF_COLOR(KColorRed);
	
    gc.SetPenSize(PenSize);
	gc.SetPenStyle(CGraphicsContext::ESolidPen);
	gc.SetPenColor(colorBlue);
	gc.DrawLine(point1,point2);

    TPoint point3(10,50);
	TPoint point4(100,50);
    gc.SetPenSize(PenSize);
	gc.SetPenStyle(CGraphicsContext::EDottedPen);
	gc.SetPenColor(colorRed);
	gc.DrawLine(point3,point4);
    }

// ---------------------------------------------------------
// CBasicDrawContainer::HandleControlEventL(
//     CCoeControl* aControl,TCoeEvent aEventType)
// ---------------------------------------------------------
//
void CBasicDrawContainer::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 + -