delphi valuelisteditor控件的使用

来源:互联网 发布:sql server是数据库吗 编辑:程序博客网 时间:2024/05/20 08:26
delphi valuelisteditor控件的使用
2010-04-21 16:49

1.获取valuelisteditor的value的值:

   str := valuelisteditor.value['top']; top为key的内容。

2. 获取valuelisteditor的key值:

   str:=valuelisteditor.key[0]; 获取第0 个key值。

3.插入一行数据

valuelisteditor.InsertRow('pp','pp1',true);
//第一个参数:key的值(字符串型)
//第二个参数: value的值(字符串型)
//第三个参数:是否追加,TRUE在最后一行加上一行,FALSE在获得焦点的一行的后面加上一行.

4. 删除一行数据

ValueListEditor1.DeleteRow(2);

5.如何选择行列
 当前选中的行通过currrow:=Valuelisteditor1.row获得
 当前选中的列通过currcol:=ValueListEditor1.col获得

6.ValueListEditor,用string.clean清除!

7.一个key值,多个value.

procedure TForm1.ValueListEditor1GetPickList(Sender: TObject;
const KeyName: String; Values: TStrings);
var
    str:string;
begin
    str:=self.ComboBox1.Text;
    str:=leftStr(str,4);
    if str='Edit' then
    begin
        if KeyName='BorderStyle' then
        begin
            Values[0]:='bssingle';
            values[1]:='bsnone';
        end;
    end;
end;

另一个方法

ValueListEditor1.ItemProps[0].PickList.Add('a1');
ValueListEditor1.ItemProps[0].PickList.Add('a2');
ValueListEditor1.ItemProps[0].PickList.Add('a3');

第三种方法:

    Index := ValueListEditor1.InsertRow('Size', '9', True);
     with ValueListEditor1.ItemProps[Index - 1].PickList do
    begin
Add('9');
Add('11');
Add('13');
Add('20');
end;

8。加入。。按钮

Index := ValueListEditor1.InsertRow('Color', 'clRed', True);
ValueListEditor1.ItemProps[Index - 1].EditStyle := esEllipsis;

procedure TForm1.ValueListEditor1EditButtonClick(Sender: TObject);
var
nRow: Integer;
begin
nRow := ValueListEditor1.Row;
case nRow of
2:
with TColorDialog.Create(nil) do
begin
if Execute then
ValueListEditor1.Cells[2, nRow] := ColorToString(Color);
end;
end;
end;

原创粉丝点击