Symbian 5th系统滚动条使用
2010-04-21 01:20:00 来源:WEB开发网}
void CMyControl::SizeChanged()
{
// Here you are required to define the size of your scrollbar//
TInt listStatusPaneHeight=60;
TEikScrollBarFrameLayout layout;
TEikScrollBarModel myModel;
TEikScrollBarModel myModel2;
myModel.iThumbSpan=1;
myModel.iScrollSpan =iScrollSpan;
layout.iTilingMode=TEikScrollBarFrameLayout::EInclusiveRectConstant;
TRect fullRect =TRect(TPoint(Rect().iTl.iX,Rect().iTl.iY+listStatusPaneHeight),TSize(Rect().Size().iWidth,Rect ().Size().iHeight-listStatusPaneHeight));
TRect inclRect = fullRect;
if(iSBFrame)
{
TBool stat = iSBFrame->TileL(&myModel2, &myModel, fullRect, inclRect, layout);
iSBFrame->DrawScrollBarsNow();
}
}
void CMyControl::HandleScrollEventL(CEikScrollBar* aScrollBar,TEikScrollEvent aEventType )
{
switch(aEventType)
{
case EEikScrollThumbDragVert:
{
CEikScrollBar* sb= iSBFrame->VerticalScrollBar();// get an object of your scroll bar
TInt pos=sb->ThumbPosition();/// it will provide new position of scrollbar
if(iScrollPos
{
iScrollPos=pos;/// moving down number of scroll span
iIsScrollDown=ETrue;
}
else
{
iScrollPos=pos;/// moving down number of scroll span
iIsScrollDown=EFalse;
}
DrawNow();
break;
}
case EEikScrollThumbReleaseVert:
break;
default:
break;
}
}
让大家见笑了。争取抽点时间写写我自己的东西。
更多精彩
赞助商链接