コード例 #1
0
        /// <summary>
        /// Handles the BeforeExpand event of the TreeView control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Forms.TreeViewCancelEventArgs"/> instance containing the event data.</param>
        private void TreeView_BeforeExpand(object sender, System.Windows.Forms.TreeViewCancelEventArgs e)
        {
            if (e.Node.Text == "Indexes")
            {
                string tableName       = e.Node.Parent.Text;
                int    tableImageIndex = e.Node.Parent.ImageIndex;

                string databaseName     = e.Node.Parent.Parent.Parent.Text;
                string connectionString = GetConnectionString(e.Node);

                if (Hobt.HobtType(connectionString, databaseName, tableName) == StructureType.Heap)
                {
                    TreeNode heapNode = new TreeNode("(Heap)", tableImageIndex, tableImageIndex);
                    e.Node.Nodes.Add(heapNode);

                    AddIndexPageNodes(connectionString, heapNode, databaseName, tableName, string.Empty, e.Node.Parent.Parent.ImageIndex);
                }
            }
        }