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

關於怎做以下的listbox......

答題得分者是:pceyes
windham
一般會員


發表:15
回覆:22
積分:7
註冊:2006-07-28

發送簡訊給我
#1 引用回覆 回覆 發表時間:2006-07-28 21:24:33 IP:218.102.xxx.xxx 未訂閱
這個一直不知怎做................
希望能指教一下><
附加檔案:00220060725163531.png
pceyes
尊榮會員


發表:70
回覆:657
積分:1140
註冊:2003-03-13

發送簡訊給我
#2 引用回覆 回覆 發表時間:2008-07-13 17:46:19 IP:220.141.xxx.xxx 訂閱
listview


[code delphi]
procedure TForm1.FormActivate(Sender: TObject);
var
i : integer;
Mytitle : Array of string;
MyWidth : Array of integer;
ListItem: TListItem;
alarmfile_st ,temp_st: tstringlist;
str : string;
begin
// prepare text file
alarmfile_st := tstringlist.create;
temp_st := tstringlist.create;
alarmfile_st.LoadFromFile('alarm.txt');

// title name
SetLength(Mytitle, 4);
Mytitle[0]:= '提醒日';
Mytitle[1]:= '到期日';
Mytitle[2]:= '抬頭';
Mytitle[3]:= '內容';
// field width
SetLength(Mywidth, 4);
Mywidth[0]:= listview1.Font.Size*8;
Mywidth[1]:= listview1.Font.Size*7;
Mywidth[2]:= listview1.Font.Size*10;
Mywidth[3]:= listview1.Font.Size*20;
// set title
for i := 0 to 3 do begin
listview1.Columns.Add;
listview1.Columns[i].Caption := Mytitle[i];
listview1.Columns[i].Width := Mywidth[i];
end;

// set items
with listview1 do begin
for I := 0 to alarmfile_st.Count-1 do
begin
str := alarmfile_st[i];
temp_st.Text := stringreplace(Str,'',#13,[rfReplaceAll]);
ListItem := Items.Add;
ListItem.Caption := temp_st[0];
ListItem.SubItems.Add(temp_st[1]);
ListItem.SubItems.Add(temp_st[2]);
if pos('
',temp_st[3])<>-1 then begin
ListItem.SubItems.Add(stringreplace(temp_st[3],'
',#13 #10,[rfReplaceAll]));
end;
end;
end;

// setup listview
listview1.ViewStyle := vsReport ;
listview1.RowSelect := false;

// set listview button1 button2 position
SetPosition;
end;

[/code]
------
努力會更接近成功
系統時間:2024-04-25 9:52:03
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!