用一个TBitmap获取TImageList里的图片,第一次是正确的,第二次开始就不对了.
Graphics::TBitmap * bmp = new Graphics::TBitmap() ;
bmp->PixelFormat = pf24bit ;
for(int s=0 ; s < Form3->il_weather->Count ; s++)
{
Form3->il_weather->GetBitmap( s , bmp ) ;
...
}
delete bmp ;
但是如果改成这样就没问题
for(int s=0 ; s < Form3->il_weather->Count ; s++)
{
Graphics::TBitmap * bmp = new Graphics::TBitmap() ;
bmp->PixelFormat = pf24bit ;
Form3->il_weather->GetBitmap( s , bmp ) ;
...
delete bmp ;
}
[解决办法]
bmp->Canvas->Refresh();//这回应该没记错
[解决办法]
当用一个bmp的时候要先擦除原来的啊,和在image里面绘图是一样一样的啊
这样:
bmp->Canvas->FillRect(TRect(0,0,bmp->Width,bmp->Height));
第二个之所以正确是因为每次使用的都是全新的,没有画国内容的
这就象在bmp上绘图,你先画一条线,再画一条线时,是得到两条线,要擦除后再画才能只得到一条线
[解决办法]
Graphics::TBitmap *bmp = new Graphics::TBitmap();
bmp->PixelFormat = pf24bit;
for(int s = 0; s < Form3->il_weather->Count; s++)
{
bmp->Assign(NULL);
Form3->il_weather->GetBitmap(s , bmp);
...
}
delete bmp;