delphi xe5 android listbox的 TMetropolisUIListBoxItem

Posted on 2013-09-29 14:57  至今  阅读(2184)  评论(1编辑  收藏  举报

listbox实现以下效果:

\

 

 

关键代码,采用数据集的方式

type
  PpatientData=^RpatientData;
  RpatientData= record
     patient_id:string;
     admiss_times:Integer;
     inpatient_no:string;
     name:string;
     sex:string;
     bed_no:string;
     nurse_level:string;
     diag:string;
   end;

                                                                                       







var
   item:TMetropolisUIListBoxItem;
   p:PpatientData;
begin
    with cdspatientlist do
    begin
     DisableControls;
         try
          First;
             while not Eof  do
             begin
                 New(p);
                 p.patient_id:=FieldByName('inpatient_no').AsString;
                 p.admiss_times:=1;
                 p.inpatient_no:=FieldByName('inpatient_no').AsString;
                 p.bed_no:=FieldByName('inpatient_no').AsString+'';
                 p.nurse_level:=FieldByName('nurse_level').AsString;
                 p.diag:=FieldByName('diag').AsString;
                 p.name:= FieldByName('name').AsString;
                 p.sex:=FieldByName('sex').AsString;
                 item:=TMetropolisUIListBoxItem.Create(ListBoxPatient);
                 item.Font.Size:=14;
                 item.Title:='姓名:'+p.name+'-'+'    性别:'+p.sex;
                 item.SubTitle:=p.bed_no+'    护理:'+p.nurse_level;
                 item.Description:='诊断:'+p.diag ;
                 if p.sex='' then
                 item.Icon.Assign(Image1.MultiResBitmap.Items[0].Bitmap)
                 else
                 item.Icon.Assign(Image1.MultiResBitmap.Items[1].Bitmap);
                 ListBoxPatient.AddObject(item);
                 Next;
             end;
         finally
          EnableControls;
         end;
    end;

 

 

Copyright © 2024 至今
Powered by .NET 9.0 on Kubernetes