C:\Users\Public\Documents\RAD Studio\12.0\Samples\FireMonkeyMobile\ListViewide
路徑下有兩個dpk,裝完後listview也能實現listbox的效果了spa
procedure TFormMain.FillListBox; var // item:TMetropolisUIListBoxItem; // listitem:TListboxItem; p: PpatientData; LItem: TListViewItem; i: Integer; begin ListViewPatient.Items.Clear; if not cdspatientlist.Active then Exit; ListViewPatient.BeginUpdate; try with cdspatientlist do begin DisableControls; try i := 1; First; while not Eof do begin New(p); p.patient_id := FieldByName('patient_id').AsString; p.admiss_times := FieldByName('admiss_times').AsInteger; p.inpatient_no := FieldByName('inpatient_no').AsString; p.bed_no := FieldByName('bed_no').AsString + '牀'; p.nurse_level := FieldByName('nurse_level').AsString; p.diag := FieldByName('diag').AsString; p.name := FieldByName('name').AsString; p.sex := FieldByName('sex').AsString; p.age := FieldByName('age').AsString; p.charge_total := FieldByName('charge_total').AsString; p.yue := FieldByName('yue').AsString; LItem := ListViewPatient.Items.Add; LItem.Text := p.bed_no; LItem.Data[TMultiDetailAppearanceNames.Detail1] := '姓名 :' + p.name; LItem.Data[TMultiDetailAppearanceNames.Detail2] := '護理等級:' + p.nurse_level; LItem.Data[TMultiDetailAppearanceNames.Detail3] := '診斷 :' + p.diag; if p.sex = '女' then LItem.BitmapRef := (Image1.MultiResBitmap.Items[0].Bitmap) else if p.sex = '男' then LItem.BitmapRef := (Image1.MultiResBitmap.Items[1].Bitmap); if p.sex = '1' then LItem.BitmapRef := Image1.MultiResBitmap.Items[1].Bitmap else LItem.BitmapRef := Image1.MultiResBitmap.Items[0].Bitmap; Inc(i); Next; end; finally EnableControls; end; end; finally ListViewPatient.EndUpdate; end; end;