Directory tree and property grid
/*
User Interfaces in C#: Windows Forms and Custom Controls
by Matthew MacDonald
Publisher: Apress
ISBN: 1590590457
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace DirectoryTreeHost
{
/// <summary>
/// Summary description for DirectoryTreeHost.
/// </summary>
public class DirectoryTreeHost : System.Windows.Forms.Form
{
private DirectoryTreeControl.DirectoryTree dirTree;
private System.Windows.Forms.PropertyGrid propertyGrid1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public DirectoryTreeHost()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dirTree = new DirectoryTreeControl.DirectoryTree();
this.propertyGrid1 = new System.Windows.Forms.PropertyGrid();
this.SuspendLayout();
//
// dirTree
//
this.dirTree.Drive = 'C';
this.dirTree.ImageIndex = -1;
this.dirTree.Location = new System.Drawing.Point(292, 12);
this.dirTree.Name = "dirTree";
this.dirTree.SelectedImageIndex = -1;
this.dirTree.Size = new System.Drawing.Size(276, 272);
this.dirTree.TabIndex = 0;
//
// propertyGrid1
//
this.propertyGrid1.CommandsVisibleIfAvailable = true;
this.propertyGrid1.LargeButtons = false;
this.propertyGrid1.LineColor = System.Drawing.SystemColors.ScrollBar;
this.propertyGrid1.Location = new System.Drawing.Point(12, 12);
this.propertyGrid1.Name = "propertyGrid1";
this.propertyGrid1.SelectedObject = this.propertyGrid1;
this.propertyGrid1.Size = new System.Drawing.Size(260, 272);
this.propertyGrid1.TabIndex = 1;
this.propertyGrid1.Text = "propertyGrid1";
this.propertyGrid1.ViewBackColor = System.Drawing.SystemColors.Window;
this.propertyGrid1.ViewForeColor = System.Drawing.SystemColors.WindowText;
//
// DirectoryTreeHost
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 14);
this.ClientSize = new System.Drawing.Size(592, 298);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.propertyGrid1,
this.dirTree});
this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
this.Name = "DirectoryTreeHost";
this.Text = "DirectoryTreeHost";
this.Load += new System.EventHandler(this.DirectoryTreeHost_Load);
this.ResumeLayout(false);
}
#endregion
private void DirectoryTreeHost_Load(object sender, System.EventArgs e)
{
}
public static void Main()
{
Application.Run(new DirectoryTreeHost());
}
}
}
|
HTML code for linking to this page:
|
|