uses
windows, messages, sysutils, variants,
classes, graphics, controls, forms,
dialogs, comctrls, stdctrls, grids;
type
tform1 = class(tform)
treeview1:
ttreeview;
stringgrid1:
tstringgrid;
procedure
formcreate(sender: tobject);
procedure
treeview1change(sender: tobject; node: ttreenode);
end;
varform1: tform1;
implementation
procedure tform1.formcreate(sender: tobject);
varnodes: ttreenodes;
node: ttreenode;
begin
treeview1.align := alleft;
nodes := treeview1.items;
node := nodes.add(nil, '一連長');
node := nodes.addchild(node, '一排長');
node := nodes.addchild(node, '一班長');
node := nodes.addchild(node, '戰士1');
nodes.add(node, '戰士2');
nodes.add(node, '戰士3');
nodes.add(node, '戰士4');
node := node.parent;
nodes.add(node, '二班長');
nodes.add(node, '三班長');
node := node.parent;
nodes.add(node, '二排長');
nodes.add(node, '三排長');
node := node.parent;
nodes.add(node, '二連長');
nodes.add(node, '三連長');
with stringgrid1 do begin
align := alclient;
fixedrows := 0;
colcount := 2;
colwidths[0] :=
78;colwidths[1] :=
50;defaultrowheight :=
18;rowcount := 15;
cells[0,0]
:= '當前選擇';
cells[0,1]
:= '序號';
cells[0,2]
:= '所在級別';
cells[0,3]
:= '在兄弟中排行';
cells[0,4]
:= '下級總數';
cells[0,5]
:= '上級元素';
cells[0,6]
:= '上乙個';
cells[0,7]
:= '下乙個';
cells[0,8]
:= '上乙個兄弟';
cells[0,9]
:= '下乙個兄弟';
cells[0,10] :=
'上乙個可見';
cells[0,11] :=
'下乙個可見';
cells[0,12] :=
'第乙個下級';
cells[0,13] :=
'最後乙個下級';
cells[0,14] :=
'總數';
end;
end;
procedure tform1.treeview1change(sender: tobject; node:
ttreenode);
begin
with stringgrid1 do begin
stringgrid1.cols[1].clear;
cells[1,0] :=
node.text;
cells[1,1] :=
inttostr(node.absoluteindex);
cells[1,2] :=
inttostr(node.level);
cells[1,3] :=
inttostr(node.index);
cells[1,4] :=
inttostr(node.count);
if boolean(node.parent)
then cells[1,5] := node.parent.text;
if boolean(node.getprev)
then cells[1,6] := node.getprev.text;
if boolean(node.getnext)
then cells[1,7] := node.getnext.text;
ifboolean(node.getprevsibling) then cells[1,8] :=
node.getprevsibling.text;
ifboolean(node.getnextsibling) then cells[1,9] :=
node.getnextsibling.text;
ifboolean(node.getprevvisible) then cells[1,10] :=
node.getprevvisible.text;
ifboolean(node.getnextvisible) then cells[1,11] :=
node.getnextvisible.text;
if node.haschildren then
cells[1,12] := node.getfirstchild.text;
if node.haschildren then
cells[1,13] := node.getlastchild.text;
cells[1,14] :=
inttostr(node.owner.count);
end;
end;
end.
HTMLEditor類常用屬性說明
allowdrop 是否允許拖拉操作 documentencoding 文件編碼,常設定為 encodingtype.gb2312 defaultpreamble 編碼 也應設定為 encodingtype.gb2312 contextmenustrip 右鍵選單 htmldocument html...
SerialPort類的常用屬性及方法
分類 排隊叫號 vb.net 2011 04 05 21 17 36人閱讀收藏 舉報 一 serialport類的常用屬性 名 稱 說 明 basestream 獲取 serialport 物件的基礎 stream 物件 baudrate 獲取或設定序列波特率 breakstate 獲取或設定中斷訊...
string類的常用屬性和方法
靜態方法 string.format 格式化字串 string.concat string,string 字串連線 string.compare string,string 字串比較。相等返回0,大於返回1,小於返回 1 string.comparenocase 字串比較不區分大小寫 例項方法 st...