日期:2014-05-17  浏览次数:20922 次

c# treeView 节点问题
我的节点是
A
 -B
 -C
 -D

B
 -E
 -F

E
 -a
 -b


我想把它弄成
A
 -B
   -E
     -a
     -b
   -F
 -C
 -D


求大家帮帮忙。。。
C# TreeView 兄弟节点? 子节点

------解决方案--------------------
如果你能确认第一个结点为主结点,那么很简单,遍历第一个结点下的所有结点,发现和其他根结点同名的,就把其他结点的子节点添加进来,再把那个删除即可。
------解决方案--------------------
用这个子集
B
 -E
 -F
替换
A
 -B
 -C
 -D
中的-B
然后用这个子集
E
 -a
 -b
替换
B
 -E
 -F
的孩子E

------解决方案--------------------

/*
 * 由SharpDevelop创建。
 * 用户: Administrator
 * 日期: 2013-7-20
 * 时间: 9:57
 * 
 * 要改变这种模板请点击 工具
------解决方案--------------------
选项
------解决方案--------------------
代码编写
------解决方案--------------------
编辑标准头文件
 */
using System;
using System.Text;
using System.Collections.Generic;
using System.Collections;
using System.IO;
using System.Diagnostics;
using System.Linq;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Windows.Forms;

namespace 资源管理器的应用
{
/// <summary>
/// Description of MainForm.
/// </summary>
public partial class MainForm : Form
{
public MainForm()
{
//
// The InitializeComponent() call is required for Windows Forms designer support.
//
InitializeComponent();

//
// TODO: Add constructor code after the InitializeComponent() call.