關於怎做以下的listbox...... |
答題得分者是:pceyes
|
windham
一般會員 發表:15 回覆:22 積分:7 註冊:2006-07-28 發送簡訊給我 |
這個一直不知怎做................
希望能指教一下>< |
pceyes
尊榮會員 發表:70 回覆:657 積分:1140 註冊:2003-03-13 發送簡訊給我 |
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,' 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]
------
努力會更接近成功 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |