listview里边动态创建ListItem的同时创建对应的combobox,怎么能跟ListItem绑定,一起滚动。创建的代码如下:var
lItem: TListItem;
combox: TComboBox;
num: integer;
R: TRect; lItem := ListView1.Items.Add;
lItem.Caption := ‘内容’;
lItem.SubItems.add(IntToStr(num)); //作为序号
//确定下拉选择框的位置
R := lItem.DisplayRect(drBounds );
r.Left := r.Left + ListView1.Columns[0].Width;
r.Right := r.Left + ListView1.Columns[1].Width - 8 ;
combox := TComboBox.Create(self);
combox.Parent := ListView1;
combox.Items.Assign(tList);
combox.Style := csDropDownList;
combox.ItemIndex := 0;
combox.Name := 'com' + IntToStr(num);
combox.Tag := num;
combox.BoundsRect := R;
combox.Visible := True;
lItem: TListItem;
combox: TComboBox;
num: integer;
R: TRect; lItem := ListView1.Items.Add;
lItem.Caption := ‘内容’;
lItem.SubItems.add(IntToStr(num)); //作为序号
//确定下拉选择框的位置
R := lItem.DisplayRect(drBounds );
r.Left := r.Left + ListView1.Columns[0].Width;
r.Right := r.Left + ListView1.Columns[1].Width - 8 ;
combox := TComboBox.Create(self);
combox.Parent := ListView1;
combox.Items.Assign(tList);
combox.Style := csDropDownList;
combox.ItemIndex := 0;
combox.Name := 'com' + IntToStr(num);
combox.Tag := num;
combox.BoundsRect := R;
combox.Visible := True;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货