TListView为某一项显示图片
void __fastcall TForm1::lv1CustomDraw(TCustomListView *Sender,
const TRect &ARect, bool &DefaultDraw)
{
TJPEGImage *jpg = new TJPEGImage();
Graphics::TBitmap *bitmap = new Graphics::TBitmap();
jpg->LoadFromFile("C:\\WINDOWS\\SYSTEM\\OOBE\\IMAGES\\BGCC.JPG");
bitmap->Assign(jpg);
lv1->Canvas->CopyRect(ARect,bitmap->Canvas,Rect(0,0,bitmap->Width,bitmap->Height));
}
#include <Graphics.hpp>
#include <Jpeg.hpp>
然后是ListView的CustomDraw事件
void __fastcall TForm1::lv1CustomDraw(TCustomListView *Sender,
const TRect &ARect, bool &DefaultDraw)
{
Graphics::TBitmap *bitmap = new Graphics::TBitmap();
bitmap->LoadFromFile("c:\\windows\\forest.bmp");
lv1->Canvas->CopyRect(ARect,bitmap->Canvas,Rect(0,0,bitmap->Width,bitmap->Height));
}
浙公网安备 33010602011771号