INI和TreeViwe做結合 |
尚未結案
|
arvin
一般會員 發表:12 回覆:9 積分:4 註冊:2002-09-11 發送簡訊給我 |
|
shinjie
資深會員 發表:12 回覆:275 積分:287 註冊:2003-03-19 發送簡訊給我 |
|
bennykyp
一般會員 發表:11 回覆:31 積分:8 註冊:2004-10-21 發送簡訊給我 |
[Tree1]
NCategory1=View1
m1=Child1
m2=Child2 [Tree2]
NCategory2=View2
s1=Child1
s2=Child2 Ini 的設定
==================================================================
Function TForm1.ReadIniFile : Boolean;
var
GIni : TIniFile;
Path : String;
begin
Result := True;
path := ExtractFilePath(Application.ExeName) 'Tree.ini';
if not FileExists(path) then
begin
MessageDlg('Configuration File ''Tree.ini'' not found ', mtError, [mbOk], 0);
Result := False;
exit;
end; If Result then
Begin
try
GIni := TIniFile.Create(path);
with GIni do
begin
TreeView1.Items.NCategory := Add(Nil,Readstring(Tree1, NCategory1, ''));
TreeView1.Items.Nchild1 := AddChild(NCategory, Readstring(Tree1, m1, ''));
TreeView1.Items.Nchild2 := AddChild(NCategory, Readstring(Tree1, m2, '')); TreeView1.Items.NCategory := Add(Nil,Readstring(Tree2, NCategory2, ''));
TreeView1.Items.Nchild1 := AddChild(NCategory, Readstring(Tree2, s1, ''));
TreeView1.Items.Nchild2 := AddChild(NCategory, Readstring(Tree2, s2, ''));
end;
Finally
GIni.Free;
end;
End;
end; 但這樣的做法只會造成INI file 越來越大 , 較理想的做法是放進 Table 裡.
純屬個人意見
|
turing
一般會員 發表:0 回覆:1 積分:0 註冊:2004-12-28 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |