编辑:底部更新。TComboBoxEx项目在运行时填充时不会缩进
希望有人可以帮助这里,因为它是驾驶我转弯!
德尔福2009年
我上面有两个TComboxBoxEx组件的形式
一个我填充在运行时用下面的代码
procedure TForm1.btn1Click(Sender: TObject);
var
N: Integer;
begin
cb1.ItemsEx.Add.Caption := 'Test';
for N := 0 to 5 do
with cb1.ItemsEx.Add do
begin
Caption := 'Item ' + IntToStr(N);
Indent := 1;
end;
end;
其他的我在设计时使用相同的填充数据并设置相同的属性。
我在运行时填充的项目中并没有缩进,而设计时间的项目缩进得很好。
任何想法?帮助中说,ident是要缩进的像素数,但设计时缩进的像素数缩进了多于一个像素,即使缩进设置为1.
例如,在上面的代码中将缩进设置为10没有效果。
下面是DFM为设计时间comobo
object cb2: TComboBoxEx
Left = 184
Top = 8
Width = 145
Height = 22
ItemsEx = <
item
Caption = 'Test'
end
item
Caption = 'Item 0'
Indent = 1
end
item
Caption = 'Item 1'
Indent = 1
end
item
Caption = 'Item 2'
Indent = 1
end
item
Caption = 'Item 3'
Indent = 1
end
item
Caption = 'Item 4'
Indent = 1
end
item
Caption = 'Item 5'
Indent = 1
end>
ItemHeight = 16
TabOrder = 2
Text = 'cb1'
end
更新
标题和缩进后设置组合项数据属性的部分似乎得到它的工作。
procedure TForm1.btn1Click(Sender: TObject);
var
N: Integer;
begin
cb1.ItemsEx.Add.Caption := 'Test';
for N := 0 to 5 do
with cb1.ItemsEx.Add do
begin
Caption := 'Item ' + IntToStr(N);
Indent := 1;
Data := Pointer(N); // New Line
end;
end;
有点奇怪。
如果我是你,我会向QC汇报。 – 2009-08-21 16:19:58
是的,我认为我会 – Jamie 2009-08-21 19:13:45