請問獲取TREEVIEW中某節點的為第几層的怎么寫 ( 积分: 50 )

  • 主题发起人 主题发起人 fusm_2000
  • 开始时间 开始时间
F

fusm_2000

Unregistered / Unconfirmed
GUEST, unregistred user!
this.Cursor = Cursors.WaitCursor;
this.tvFolder.Nodes.Clear();
string sql="select PRJ_NAME from C_TREE_PROJ_T where PRJ_ID=0";
query1=new OleDbCommand(sql,this.conn1);
this.conn1.Close();
this.conn1.Open();
myread=query1.ExecuteReader();
if (!myread.HasRows)
{
MessageBox.Show("資料庫初始化失敗﹗即將退出﹗");
Application.Exit();
}
myread.Read();
string filename=myread.GetValue(0).ToString();
then
ode=new TreeNode(filename,1,1);
this.tvFolder.begin
Update();
this.tvFolder.Nodes.Add(then
ode);
myread.Close();
string sql2="select PRJ_NAME from C_TREE_PROJ_T where PRJ_ID>0";
query1=new OleDbCommand(sql2,this.conn1);
this.conn1.Close();
this.conn1.Open();
myread=query1.ExecuteReader();
if (!myread.HasRows)
{
this.tvFolder.EndUpdate();
this.Cursor=Cursors.Default;
return;
}
while(myread.Read())
{
string addname=myread.GetValue(0).ToString();
then
ode=new TreeNode(addname,1,2);
this.tvFolder.Nodes[0].Nodes.Add(then
ode);
}
this.tvFolder.EndUpdate();
 
this.Cursor = Cursors.WaitCursor;
this.tvFolder.Nodes.Clear();
string sql="select PRJ_NAME from C_TREE_PROJ_T where PRJ_ID=0";
query1=new OleDbCommand(sql,this.conn1);
this.conn1.Close();
this.conn1.Open();
myread=query1.ExecuteReader();
if (!myread.HasRows)
{
MessageBox.Show("資料庫初始化失敗﹗即將退出﹗");
Application.Exit();
}
myread.Read();
string filename=myread.GetValue(0).ToString();
then
ode=new TreeNode(filename,1,1);
this.tvFolder.begin
Update();
this.tvFolder.Nodes.Add(then
ode);
myread.Close();
string sql2="select PRJ_NAME from C_TREE_PROJ_T where PRJ_ID>0";
query1=new OleDbCommand(sql2,this.conn1);
this.conn1.Close();
this.conn1.Open();
myread=query1.ExecuteReader();
if (!myread.HasRows)
{
this.tvFolder.EndUpdate();
this.Cursor=Cursors.Default;
return;
}
while(myread.Read())
{
string addname=myread.GetValue(0).ToString();
then
ode=new TreeNode(addname,1,2);
this.tvFolder.Nodes[0].Nodes.Add(then
ode);
}
this.tvFolder.EndUpdate();
 
procedure TFunPuckerFrm.FileListViewClick(Sender: TObject);
var
i:integer;
Node:TTreeNode;
begin

I:=0;
Node:=(Sender as TTreeView).Selected;
While Node<>Nildo
begin
Node:=Node.Parent;
i:=i=1;
end;
 
i:=TreeView1.selected.level
 
在C#中就沒有ID 或LEVEL呀﹗有別的知道嗎
 
后退
顶部