void __fastcall TForm3D1::ShowStr(int X,int Y,UnicodeString sStr)
{
int i,m; UnicodeString s;
Image1->Bitmap->Canvas->BeginScene();
Image1->Bitmap->Canvas->DrawBitmap(bkMap,TRectF(0,0,19*6,33),
TRectF(X,Y,X+6*19,Y+33),20);//恢复背景,见上面的定义。
Image1->Bitmap->Canvas->Fill->Color =(TAlphaColor)claBlue;//画一个蓝色透明圆角方框。
Image1->Bitmap->Canvas->FillRect(TRectF(X,Y,X+5*19,Y+33),10, 10, AllCorners,0.5);
for(i=0;i<sStr.Length();i++)
{//要特别注意:在andorid中SubString索引是从0开始,但在win32中,要从1开始,所以如果在
s = sStr.SubString(i,1);//win32下,该行要改为 sStr.SubString(i+1,1),折腾死了!
if(s == L":") ShowNum(X + i * 19,Y+5,10);//显示:
else ShowNum(X + i*19,Y+5,StrToInt(s));//显示数字,高度增加5个单位。
}
Image1->Bitmap->Canvas->EndScene();
}
//---------------------------------------------------------------------------
7、输出文字
void __fastcall TForm3D1::ShowSum(int X,int Y,int iNum)
{
TRectF showRect;
Image1->Bitmap->Canvas->BeginScene();
showRect.init(X + 10,Y, X + 22, Y + 16);
//写一个数字。
Image1->Bitmap->Canvas->FillText(showRect,IntToStr(iNum), false, 100,
TFillTextFlags() << TFillTextFlag::RightToLeft, TTextAlign::Center,
TTextAlign::Center);
Image1->Bitmap->Canvas->EndScene();
}
//---------------------------------------------------------------------------