全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1830
推到 Plurk!
推到 Facebook!

請教多欄位ListView的編輯

尚未結案
blue
中階會員


發表:169
回覆:136
積分:81
註冊:2002-04-15

發送簡訊給我
#1 引用回覆 回覆 發表時間:2019-01-15 17:33:12 IP:125.227.xxx.xxx 未訂閱
Hi,各位先進大家好:
小弟想用ListView 顯示分群組並指定欄位可編輯,
如下,能否設定 Last name & First Name不可編輯, Age 可編輯?
謝謝!

procedure TForm1.FormCreate(Sender: TObject);
const
Names: array[0..5, 0..2] of string = (
('Rubble', 'Barney', '10'),
('Michael', 'Johnson', '15'),
('Bunny', 'Bugs', '20'),
('Silver', 'HiHo', '25'),
('Simpson', 'Bart', '20'),
('Squirrel', 'Rocky', '10')
);

var
I: Integer;
NewColumn: TListColumn;
ListItem: TListItem;
ListView: TListView;
begin
ListView := TListView.Create(Self);
with ListView do begin
Parent := Self;
Align := alClient;
ViewStyle := vsReport;

NewColumn := Columns.Add;
NewColumn.Caption := 'Last';
NewColumn := Columns.Add;
NewColumn.Caption := 'First';
NewColumn := Columns.Add;
NewColumn.Caption := 'Age';

for I := Low(Names) to High(Names) do
begin
ListItem := Items.Add;
ListItem.Caption := Names[I][0];
ListItem.SubItems.Add(Names[I][1]);
ListItem.SubItems.Add(Names[I][2]);
end;
end;
end;
系統時間:2024-04-30 4:18:16
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!