松鼠的博客

导航

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));  
  }

posted on 2008-08-27 23:11  Xproer-松鼠  阅读(241)  评论(0)    收藏  举报