Symbian 中大段文本显示控件详解
2010-02-22 20:53:00 来源:WEB开发网}
void CTextDisplay::SetBackground(TRgb aRgb)
{
iBackGround = aRgb;
}
void CTextDisplay::AccountTotalLine()
{
for(TInt i=0;i
{
TInt nStringMaxDisplayLine = iFont->TextWidthInPixels((*iDisplayContent)[i]->Des())/(iRect.Width() - iScrollBarWidth) + iMaxDisplayLine;
TBidiText* bidi = TBidiText::NewL((*iDisplayContent)[i]->Des(), nStringMaxDisplayLine);
bidi->WrapText(iRect.Width()-iScrollBarWidth, *iFont, NULL);
TInt lines = bidi->NumberOfLinesInDisplayText();
iTotalLine += lines;
delete bidi;
}
}
TInt CTextDisplay::GetMaxDisplay()
{
return (iRect.Height() - LASTSPACE - iStartPoit.iY)/(iFont->HeightInPixels() + iLineToLineSpace);
}
void CTextDisplay::SetScrollBarWidth(TInt aWidth)
{
iScrollBarWidth = aWidth;
}
//创建系统滚动条
void CTextDisplay::CreateScrollBars(TInt aCunt)
{
//构造
iSBFrame=new(ELeave) CEikScrollBarFrame(iParent, NULL,ETrue);
iSBFrame->CreateDoubleSpanScrollBarsL(ETrue, EFalse,ETrue,ETrue);
iSBFrame->SetTypeOfVScrollBar(CEikScrollBarFrame::EDoubleSpan);
iSBFrame->SetScrollBarVisibilityL(CEikScrollBarFrame::EOff,
CEikScrollBarFrame::EAuto);
iModel = TEikScrollBarModel(aCunt, 1, 0);
//设置区域
TRect aRect;
aRect = TRect(TPoint(iRect.Width()-iScrollBarWidth,iRect.iTl.iY),TSize(iScrollBarWidth,iRect.Height()-LASTSPACE));
iSBFrame->Tile(&iModel,aRect);
//设置初始位置-绝对坐标
iSBFrame->MoveVertThumbTo(0);
iSBFrame->DrawScrollBarsNow();
}
// End of File
更多精彩
赞助商链接