Chinaunix首页 | 论坛 | 博客
  • 博客访问: 522383
  • 博文数量: 252
  • 博客积分: 6057
  • 博客等级: 准将
  • 技术积分: 1635
  • 用 户 组: 普通用户
  • 注册时间: 2009-12-21 10:17
文章分类

全部博文(252)

文章存档

2013年(1)

2012年(1)

2011年(32)

2010年(212)

2009年(6)

分类: C/C++

2010-07-05 12:09:12

标签:

杂谈

分类:c++builder

为什么在这里调用这个函数 后来人可以看这里

当bcb的ListView设置了CheckBoxes=True之后,就无法再 显示SubImages

来源:(http://blog.sina.com.cn/s/blog_5dfd44300100ermt.html) - 当BCB的ListView设置了CheckBoxes=True之后_jimmyWang_新浪博客

这其实是vcl的一个BUG

大家看如下VCL代码:  
  procedure   TCustomListView.ResetExStyles;  
  var  
      Styles:   DWORD;  
      TempImages:   TCustomImageList;  
  begin  
      if   HandleAllocated   then  
      begin  
          TempImages   :=   nil;  
          if   StateImages   <>   nil   then  
          begin  
              TempImages   :=   StateImages;  
              StateImages   :=   nil;  
          end;  
          Styles   :=   LVS_EX_SUBITEMIMAGES   or   LVS_EX_INFOTIP;  
          if   FCheckboxes   then   Styles   :=   LVS_EX_CHECKBOXES;        
   
          //上面这条语句明显的错误,就是因为它导致SubImages无法显示  
          //得改成Styles   :=Styles   or   LVS_EX_CHECKBOXES;  
   
   
          if   FGridLines   then   Styles   :=   Styles   or   LVS_EX_GRIDLINES;  
          if   FHotTrack   then   Styles   :=   Styles   or   LVS_EX_TRACKSELECT;  
          if   FRowSelect   then   Styles   :=   Styles   or   LVS_EX_FULLROWSELECT;  
          if   FFlatScrollBars   then   Styles   :=   Styles   or   LVS_EX_FLATSB;  
          if   FFullDrag   then   Styles   :=   Styles   or   LVS_EX_HEADERDRAGDROP;  
          if   FShowWorkAreas   then   Styles   :=   Styles   or   LVS_EX_MULTIWORKAREAS;    
          if   htHandPoint   in   FHotTrackStyles   then  
              Styles   :=   Styles   or   LVS_EX_ONECLICKACTIVATE  
          else   if   FHotTrackStyles   *   [htUnderlineHot,   htUnderlineCold]   <>   []   then  
              Styles   :=   Styles   or   LVS_EX_TWOCLICKACTIVATE;  
          if   htUnderlineHot   in   FHotTrackStyles   then  
              Styles   :=   Styles   or   LVS_EX_UNDERLINEHOT;  
          if   htUnderlineCold   in   FHotTrackStyles   then  
              Styles   :=   Styles   or   LVS_EX_UNDERLINECOLD;  
          ListView_SetExtendedListViewStyle(Handle,   Styles);  
          if   TempImages   <>   nil   then  
              StateImages   :=   TempImages;  
      end;  
  end;   
  一个函数  
  void TForm1::DisplayCheckBoxedAndSubImages(TListView*lv1)
{
        //TODO: Add your source code here
        DWORD  Styles;
        Styles=ListView_GetExtendedListViewStyle(lv1->Handle );
        Styles=Styles  LVS_EX_CHECKBOXES    LVS_EX_SUBITEMIMAGES   LVS_EX_INFOTIP;
       ListView_SetExtendedListViewStyle(lv1->Handle,Styles);
如果要同时显示CheckBoxes和SubImages,先调用一下上面的函数,就解决问题了。   
引:

阅读(1896) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2010-07-05 14:01:23

Set OwnerData to true to specify that the list view is virtual. A virtual list view can contain a huge number of items (specifically, up to a DWORD). However, you must manage the items of a virtual list view using the OnData, OnDataFind, OnDataHint, and OnDataStateChange event handlers. For example, you must explicitly provide a value to a list item 's StateIndex property i

chinaunix网友2010-07-05 14:00:33

用ListView的OnData事件出现问题,各位大虾救命啊 http://topic.csdn.net/t/20020913/09/1019697.html 我需要ListView有个CheckBox,所以直接在ListView的CheckBox属性里面就设置了 CheckBox = true; 但用了OnData事件来添加Items ,这CheckBox就没显示了 我按以下这段代码来写 /*Unit1.h*/ //--------------------------------------------------------------------------- #ifndef Unit1H #define Unit1H //--------------------------------------------------------------------------- #include #include #include