WEB开发网
开发学院手机开发Symbian 开发 Symbian CAknGrid的应用 阅读

Symbian CAknGrid的应用

 2010-05-31 20:14:00 来源:WEB开发网   
核心提示://尤其是在一些可以横屏的机器上.屏幕区域是可能变化的.void CUserGridContainer::DrawGrid(const TRect&aRect){TIntiSizeWidth = aRect.Width()/NumOfItemsWidth;TIntiSizeHeight = aRect.Height()

//尤其是在一些可以横屏的机器上.屏幕区域是可能变化的.

void CUserGridContainer::DrawGrid(const TRect&aRect)

{

TIntiSizeWidth = aRect.Width()/NumOfItemsWidth;

TIntiSizeHeight = aRect.Height()/NumOfItemsHeight;

TIntipixelWidth = 40;

TInt iLeftx= (iSizeWidth - ipixelWidth)/2;

TInt iLefty= (iSizeHeight - ipixelWidth)/2;

TInt iEndx =iLeftx + ipixelWidth;

TInt iEndy =iLefty + ipixelWidth;

iGrid->SetLayoutL( EFalse, ETrue, ETrue,NumOfItemsWidth , NumOfItemsHeight,

TSize( iSizeWidth,iSizeHeight ), 0, 0);

iGrid->ScrollBarFrame()->SetScrollBarVisibilityL

(CEikScrollBarFrame::EOff,CEikScrollBarFrame::EOff);//隐藏右边的滑轮

iGrid->SetPrimaryScrollingType(CAknGridView::EScrollIncrementLineAndLoops );

iGrid->SetSecondaryScrollingType(CAknGridView::EScrollIncrementLineAndLoops );

AknListBoxLayouts::SetupStandardGrid( *iGrid );

AknListBoxLayouts::SetupFormGfxCell(*iGrid,iGrid->ItemDrawer

(),0,iLeftx,iLefty,iEndx,iEndy,ipixelWidth,ipixelWidth,TPoint(iLeftx,iLefty),TPoint(iEndx,

iEndy));

// Set uptext subcells

const CFont*KFont = LatinBold12();

TIntbaseline = iEndy + (iSizeHeight - iEndy)/2 +KFont->DescentInPixels();

AknListBoxLayouts::SetupFormTextCell( *iGrid,iGrid->ItemDrawer(), 1 ,

KFont,

0 ,

0 , 0,

baseline ,iSizeWidth ,

CGraphicsContext::ECenter ,

TPoint(0,ipixelWidth) ,

TPoint(iSizeWidth,iSizeHeight) );

}

//根据屏幕大小决定是否重绘

void CUserGridContainer::HandleResourceChange(TInt aType)

{

CCoeControl::HandleResourceChange(aType);

if ( aType== KEikDynamicLayoutVariantSwitch )

{

TRect rect;

Tags:Symbian CAknGrid 应用

编辑录入:coldstar [复制链接] [打 印]
赞助商链接