symbian 滚动条
2010-07-04 15:57:00 来源:WEB开发网symbian 滚动条
1、声明
CEikScrollBarFrame *iScrollBarFrame;
TAknDoubleSpanScrollBarModel iHDsSbarModel;
TAknDoubleSpanScrollBarModel iVDsSbarModel;
2、实例化
// Creating Scroll Bars
iScrollBarFrame = new ( ELeave ) CEikScrollBarFrame( this, NULL );
iScrollBarFrame->CreateDoubleSpanScrollBarsL( ETrue, EFalse );
iScrollBarFrame->SetTypeOfVScrollBar( CEikScrollBarFrame::EDoubleSpan );
iScrollBarFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn );
//set
TEikScrollBarFrameLayout layout;
layout.iTilingMode = TEikScrollBarFrameLayout::EInclusiveRectConstant;
TRect rect = Rect();
iScrollBarFrame->TileL( &iHDsSbarModel, &iVDsSbarModel, rect, rect, layout );
iScrollWidth = iScrollBarFrame->ScrollBarBreadth( CEikScrollBar::EVertical );
3、更新
void UpdateScrollBarFrameL()
{
iScrollBarFrame->SetScrollBarVisibilityL( CEikScrollBarFrame::EOff, CEikScrollBarFrame::EOn );
//Update scroll bar position
iVDsSbarModel.SetScrollSpan( iCount );
iVDsSbarModel.SetWindowSize( 1 );
iVDsSbarModel.SetFocusPosition( iFocusIndex );
TEikScrollBarFrameLayout layout;
layout.iTilingMode = TEikScrollBarFrameLayout::EInclusiveRectConstant;
TRect rect = Rect();
iScrollBarFrame->TileL( &iHDsSbarModel, &iVDsSbarModel, rect, rect, layout );
iScrollBarFrame->SetVFocusPosToThumbPos( iVDsSbarModel.FocusPosition() );
}
更多精彩
赞助商链接