字符串数组的使用
1. 定义
在 rss 中
RESOURCE ARRAY r_goldenminer_help_array
{
items =
{
LBUF
{txt = qtn_goldenminer_help1;},
LBUF
{txt = qtn_goldenminer_help2;},
LBUF
{txt = qtn_goldenminer_help3;},
LBUF
{txt = qtn_goldenminer_help4;},
LBUF
{txt = qtn_goldenminer_help5;},
LBUF
{txt = qtn_goldenminer_help6;},
LBUF
{txt = qtn_goldenminer_help7;},
LBUF
{txt = qtn_goldenminer_help8;},
LBUF
{txt = qtn_goldenminer_help9;}
};
注:只能用 LBUF ,使用 TBUF 不能运行
2. 使用
gc.UseFont(AknLayoutUtils::FontFromId( EAknHighestLogicalFont ));
TInt fontHeight = AknLayoutUtils::FontFromId( EAknHighestLogicalFont )->HeightInPixels();
fontHeight += 2;
gc.SetPenColor(KRgbWhite);
CDesCArray*textArray=CoeEnv->ReadDesCArrayResourceL( R_GOLDENMINER_HELP_ARRAY );
CleanupStack::PushL(textArray);
for(TInt i = 0; i < textArray->Count(); i++)
{
gc.DrawText((*textArray)[i], TPoint(0, (i + 1)*fontHeight));
}
CleanupStack::PopAndDestroy();
gc.DiscardFont();