public MainForm() { InitializeComponent(); Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv root = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv(); DriveInfo drive = new DriveInfo(Environment.SystemDirectory); root.Text = drive.ToString(); this.multiColumnTreeView1.Nodes.AddRange(new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv[] { root }); treeColumnAdv1 = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv(); treeColumnAdv2 = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv(); treeColumnAdv3 = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv(); treeColumnAdv1.HelpText = "Name"; treeColumnAdv1.Highlighted = false; treeColumnAdv1.Text = "Name"; treeColumnAdv1.Width = this.multiColumnTreeView1.Width / 3; treeColumnAdv1.Background = new Syncfusion.Drawing.BrushInfo(System.Drawing.SystemColors.Highlight); treeColumnAdv1.AreaBackground = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.ForwardDiagonal, System.Drawing.Color.White, System.Drawing.Color.Snow); treeColumnAdv1.BorderStyle = BorderStyle.FixedSingle; treeColumnAdv2.HelpText = "Full Path"; treeColumnAdv2.Highlighted = false; treeColumnAdv2.Text = "Full Path"; treeColumnAdv2.Width = this.multiColumnTreeView1.Width / 3; treeColumnAdv2.Background = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.Highlight); treeColumnAdv2.BorderStyle = BorderStyle.FixedSingle; treeColumnAdv3.HelpText = "Date Modified"; treeColumnAdv3.Highlighted = false; treeColumnAdv3.Text = "Date Modified"; treeColumnAdv3.Width = this.multiColumnTreeView1.Width / 3; treeColumnAdv3.Background = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.Highlight); treeColumnAdv3.BorderStyle = BorderStyle.FixedSingle; this.multiColumnTreeView1.Columns.AddRange(new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv[] { treeColumnAdv1, treeColumnAdv2, treeColumnAdv3 }); this.Load += new EventHandler(MultiColumnTreeViewDemo_Load); this.multiColumnTreeView1.BeforeExpand += new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeViewAdvCancelableNodeEventHandler(multiColumnTreeView1_BeforeExpand); this.MinimumSize = this.Size; this.multiColumnTreeView1.Style = MultiColumnVisualStyle.Office2016Colorful; this.treeColumnAdv1.BaseStyle = (this.multiColumnTreeView1.BaseStylePairs[2] as Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.StyleNamePair).Name; this.treeColumnAdv1.BorderStyle = BorderStyle.FixedSingle; this.treeColumnAdv2.BorderStyle = BorderStyle.FixedSingle; this.treeColumnAdv3.BorderStyle = BorderStyle.FixedSingle; try { System.Drawing.Icon ico = new System.Drawing.Icon(GetIconFile(@"common\Images\Grid\Icon\sfgrid.ico")); this.Icon = ico; } catch { } }
public Form1() { InitializeComponent(); Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv root = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv(); DriveInfo drive = new DriveInfo(Environment.SystemDirectory); root.Text = drive.ToString(); this.multiColumnTreeView1.Nodes.AddRange(new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv[] { root }); treeColumnAdv1 = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv(); treeColumnAdv2 = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv(); treeColumnAdv3 = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv(); treeColumnAdv1.HelpText = "Name"; treeColumnAdv1.Highlighted = false; treeColumnAdv1.Text = "Name"; treeColumnAdv1.Background = new Syncfusion.Drawing.BrushInfo(System.Drawing.SystemColors.Highlight); treeColumnAdv1.AreaBackground = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.ForwardDiagonal, System.Drawing.Color.White, System.Drawing.Color.Snow); treeColumnAdv1.BorderStyle = BorderStyle.FixedSingle; treeColumnAdv2.HelpText = "Full Path"; treeColumnAdv2.Highlighted = false; treeColumnAdv2.Text = "Full Path"; treeColumnAdv2.Background = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.Highlight); treeColumnAdv2.BorderStyle = BorderStyle.FixedSingle; treeColumnAdv3.HelpText = "Date Modified"; treeColumnAdv3.Highlighted = false; treeColumnAdv3.Text = "Date Modified"; treeColumnAdv3.Background = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.Highlight); treeColumnAdv3.BorderStyle = BorderStyle.FixedSingle; this.multiColumnTreeView1.Columns.AddRange(new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv[] { treeColumnAdv1, treeColumnAdv2, treeColumnAdv3 }); this.multiColumnTreeView1.AutoSizeMode = Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.AutoSizeMode.Fill; this.Load += new EventHandler(MultiColumnTreeViewDemo_Load); this.multiColumnTreeView1.BeforeExpand += new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeViewAdvCancelableNodeEventHandler(multiColumnTreeView1_BeforeExpand); //this.MinimumSize = this.Size; this.treeColumnAdv1.BaseStyle = (this.multiColumnTreeView1.BaseStylePairs[2] as Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.StyleNamePair).Name; this.treeColumnAdv1.BorderStyle = BorderStyle.FixedSingle; this.treeColumnAdv2.BorderStyle = BorderStyle.FixedSingle; this.treeColumnAdv3.BorderStyle = BorderStyle.FixedSingle; visualStyleComboBox.DataSource = new List <string>() { "Office2019Colorful", "HighContrastBlack", "Office2016Colorful", "Office2016DarkGray", "Office2016Black", "Office2016White" }; visualStyleComboBox.SelectedIndexChanged += ComboBox_SelectedIndexChanged; visualStyleComboBox.AllowDropDownResize = false; this.visualStyleComboBox.DropDownStyle = Syncfusion.WinForms.ListView.Enums.DropDownStyle.DropDownList; this.visualStyleComboBox.SelectedIndex = 0; this.multiColumnTreeView1.FullRowSelect = true; this.singleSelectioncheckBox.Checked = true; }
public MainForm() { InitializeComponent(); Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv root = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv(); DriveInfo drive = new DriveInfo(Environment.SystemDirectory); root.Text = drive.ToString(); this.multiColumnTreeView1.Nodes.AddRange(new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv[] { root }); treeColumnAdv1 = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv(); treeColumnAdv2 = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv(); treeColumnAdv3 = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv(); treeColumnAdv1.HelpText = "Name"; treeColumnAdv1.Highlighted = false; treeColumnAdv1.Text = "Name"; treeColumnAdv1.Background = new Syncfusion.Drawing.BrushInfo(System.Drawing.SystemColors.Highlight); treeColumnAdv1.AreaBackground = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.ForwardDiagonal, System.Drawing.Color.White, System.Drawing.Color.Snow); treeColumnAdv1.BorderStyle = BorderStyle.FixedSingle; treeColumnAdv2.HelpText = "Full Path"; treeColumnAdv2.Highlighted = false; treeColumnAdv2.Text = "Full Path"; treeColumnAdv2.Background = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.Highlight); treeColumnAdv2.BorderStyle = BorderStyle.FixedSingle; treeColumnAdv3.HelpText = "Date Modified"; treeColumnAdv3.Highlighted = false; treeColumnAdv3.Text = "Date Modified"; treeColumnAdv3.Background = new Syncfusion.Drawing.BrushInfo(Syncfusion.Drawing.GradientStyle.Vertical, System.Drawing.SystemColors.Highlight, System.Drawing.SystemColors.Highlight); treeColumnAdv3.BorderStyle = BorderStyle.FixedSingle; this.multiColumnTreeView1.Columns.AddRange(new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeColumnAdv[] { treeColumnAdv1, treeColumnAdv2, treeColumnAdv3 }); this.Load += new EventHandler(MultiColumnTreeViewDemo_Load); this.multiColumnTreeView1.BeforeExpand += new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeViewAdvCancelableNodeEventHandler(multiColumnTreeView1_BeforeExpand); this.MinimumSize = this.Size; this.treeColumnAdv1.BaseStyle = (this.multiColumnTreeView1.BaseStylePairs[2] as Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.StyleNamePair).Name; this.treeColumnAdv1.BorderStyle = BorderStyle.FixedSingle; this.treeColumnAdv2.BorderStyle = BorderStyle.FixedSingle; this.treeColumnAdv3.BorderStyle = BorderStyle.FixedSingle; this.multiColumnTreeView1.ThemeName = "Office2019Colorful"; this.multiColumnTreeView1.LabelEdit = false; comboBoxAdv1.Items.AddRange(new string[] { "None", "AllCellsExceptHeader", "AllCells", "ColumnHeader", "AllCellsWithLastColumnFill", "Fill", "LastColumnFill" }); comboBoxAdv1.SelectedIndexChanged += ComboBox_SelectedIndexChanged; comboBoxAdv1.ThemeName = "Office2019Colorful"; this.splitContainer1.BorderStyle = BorderStyle.None; this.comboBoxAdv1.DropDownStyle = ComboBoxStyle.DropDownList; this.comboBoxAdv1.SelectedIndex = 5; this.multiColumnTreeView1.FullRowSelect = true; }
void multiColumnTreeView1_BeforeExpand(object sender, Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeViewAdvCancelableNodeEventArgs e) { try { //Checking whether the Node has been expanded atleast once if (e.Node.ExpandedOnce) { return; } DirectoryInfo dir = null; DirectoryInfo[] subDir = null; if (this.multiColumnTreeView1.Nodes[0].Nodes.Count == 0) //Root directory { DriveInfo drive = new DriveInfo(e.Node.Text); dir = drive.RootDirectory; subDir = dir.GetDirectories(); } else { //Get the Path of the node and AddSeparatorAtEnd Property set to true string path = e.Node.GetPath("\\"); dir = new DirectoryInfo(path); subDir = dir.GetDirectories(); } if (subDir != null) { foreach (DirectoryInfo dirinfo in subDir) { Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdvSubItem subitem1 = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdvSubItem(); Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdvSubItem subitem2 = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdvSubItem(); subitem1.Text = dirinfo.FullName; subitem1.HelpText = subitem1.Text; subitem2.Text = dirinfo.LastWriteTime.ToString(); subitem2.HelpText = subitem2.Text; Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv node = new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdv(dirinfo.Name); node.SubItems.AddRange(new Syncfusion.Windows.Forms.Tools.MultiColumnTreeView.TreeNodeAdvSubItem[] { subitem1, subitem2 }); e.Node.Nodes.Add(node); } } } catch { } }