/// <summary> /// Raises the <see cref="E:System.Windows.Forms.TreeView.BeforeExpand"/> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.TreeViewCancelEventArgs"/> that contains the event data.</param> protected override void OnBeforeExpand(TreeViewCancelEventArgs e) { if (e.Node != this.Nodes[0]) { ShellTreeMethods.DoExpand(this, e.Node); } // Call the base. base.OnBeforeExpand(e); }
/// <summary> /// Raises the <see cref="M:System.Windows.Forms.Control.CreateControl"/> method. /// </summary> protected override void OnCreateControl() { // Call the base. base.OnCreateControl(); // Add the desktop node, if we're not in design mode. if (!DesignMode) { ShellTreeMethods.AddDesktopNode(this); } }
//private void InitializeComponent() //{ // this.SuspendLayout(); // // // // ShellTreeView // // // this.ResumeLayout(false); //} protected override void OnNodeMouseClick(TreeNodeMouseClickEventArgs e) { base.OnNodeMouseClick(e); if (e.Button == MouseButtons.Right) { // Get the item hit. var itemHit = ShellObject.GetShellItem(e.Node, this.nodesToFolders); // Create a default context menu. ShellTreeMethods.OpenItemContextMenu(e.Node, itemHit, e.X, e.Y); } }