listbox里的ITEM有没有一个属性可以保存一个整数?象menuitem的TAG

解决方案 »

  1.   

    listbox中的每一个Item都可以加入一个Object,你可以将整数作为一个object保存进去。
      

  2.   

    你用left,right,top,吧. :) 呵呵! 开个玩笔你用它的Data属性,这是一个指针类型,你可以让它向一个integer.
    具体的用法在delphi中有它的使用例子
      

  3.   

    var              //增加操作
     p:Pinteger;
    begin
      New(p);
      P^:=12;
      ListBox1.Items.Add('系统管理',TObject(P));
      New(p);
      P^:=13;
      ListBox1.Items.Add('打印',TObject(P));  //自己写个过程
    end;取整数
    Num :=Pinteger(ListBox1.Objects[1])^;  //释放
    var
     i:integer
    begin
      For i:=0 to ListBox1.Items.Count-1 do
      begin 
        if  Assigned(ListBox1.Objects[i]) then
          Dispose(PInteger(ListBox1.Objects[i]));
       end;
    end;