public FolderBrowserDialog() { form = new DialogForm(this); Size formConfigSize = Size.Empty; Point formConfigLocation = Point.Empty; object formWidth = MWFConfig.GetValue(folderbrowserdialog_string, width_string); object formHeight = MWFConfig.GetValue(folderbrowserdialog_string, height_string); if (formHeight != null && formWidth != null) { formConfigSize = new Size((int)formWidth, (int)formHeight); } object formLocationX = MWFConfig.GetValue(folderbrowserdialog_string, x_string); object formLocationY = MWFConfig.GetValue(folderbrowserdialog_string, y_string); if (formLocationX != null && formLocationY != null) { formConfigLocation = new Point((int)formLocationX, (int)formLocationY); } newFolderButton = new Button(); folderBrowserTreeView = new FolderBrowserTreeView(this); okButton = new Button(); cancelButton = new Button(); descriptionLabel = new Label(); folderBrowserTreeViewContextMenu = new ContextMenu(); form.AcceptButton = okButton; form.CancelButton = cancelButton; form.SuspendLayout(); form.ClientSize = new Size(322, 324); form.MinimumSize = new Size(310, 254); form.Text = "Browse For Folder"; form.SizeGripStyle = SizeGripStyle.Show; newFolderMenuItem = new MenuItem("New Folder", new EventHandler(OnClickNewFolderButton)); folderBrowserTreeViewContextMenu.MenuItems.Add(newFolderMenuItem); // descriptionLabel descriptionLabel.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); descriptionLabel.Location = new Point(15, 14); descriptionLabel.Size = new Size(292, 40); descriptionLabel.TabIndex = 0; descriptionLabel.Text = string.Empty; // folderBrowserTreeView folderBrowserTreeView.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); folderBrowserTreeView.ImageIndex = -1; folderBrowserTreeView.Location = new Point(15, 60); folderBrowserTreeView.SelectedImageIndex = -1; folderBrowserTreeView.Size = new Size(292, 212); folderBrowserTreeView.TabIndex = 3; folderBrowserTreeView.ShowLines = false; folderBrowserTreeView.ShowPlusMinus = true; folderBrowserTreeView.HotTracking = true; folderBrowserTreeView.BorderStyle = BorderStyle.Fixed3D; folderBrowserTreeView.ContextMenu = folderBrowserTreeViewContextMenu; //folderBrowserTreeView.Indent = 2; // newFolderButton newFolderButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); newFolderButton.FlatStyle = FlatStyle.System; newFolderButton.Location = new Point(15, 285); newFolderButton.Size = new Size(105, 23); newFolderButton.TabIndex = 4; newFolderButton.Text = "Make New Folder"; newFolderButton.Enabled = true; // okButton okButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); okButton.FlatStyle = FlatStyle.System; okButton.Location = new Point(135, 285); okButton.Size = new Size(80, 23); okButton.TabIndex = 1; okButton.Text = "OK"; // cancelButton cancelButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); cancelButton.DialogResult = DialogResult.Cancel; cancelButton.FlatStyle = FlatStyle.System; cancelButton.Location = new Point(227, 285); cancelButton.Size = new Size(80, 23); cancelButton.TabIndex = 2; cancelButton.Text = "Cancel"; form.Controls.Add(cancelButton); form.Controls.Add(okButton); form.Controls.Add(newFolderButton); form.Controls.Add(folderBrowserTreeView); form.Controls.Add(descriptionLabel); form.ResumeLayout(false); if (formConfigSize != Size.Empty) { form.Size = formConfigSize; } if (formConfigLocation != Point.Empty) { form.Location = formConfigLocation; } okButton.Click += new EventHandler(OnClickOKButton); cancelButton.Click += new EventHandler(OnClickCancelButton); newFolderButton.Click += new EventHandler(OnClickNewFolderButton); form.VisibleChanged += new EventHandler(OnFormVisibleChanged); RootFolder = rootFolder; }
public FolderBrowserDialog () { form = new DialogForm (this); Size formConfigSize = Size.Empty; Point formConfigLocation = Point.Empty; object formWidth = MWFConfig.GetValue (folderbrowserdialog_string, width_string); object formHeight = MWFConfig.GetValue (folderbrowserdialog_string, height_string); if (formHeight != null && formWidth != null) formConfigSize = new Size ((int)formWidth, (int)formHeight); object formLocationX = MWFConfig.GetValue (folderbrowserdialog_string, x_string); object formLocationY = MWFConfig.GetValue (folderbrowserdialog_string, y_string); if (formLocationX != null && formLocationY != null) formConfigLocation = new Point ((int)formLocationX, (int)formLocationY); newFolderButton = new Button (); folderBrowserTreeView = new FolderBrowserTreeView (this); okButton = new Button (); cancelButton = new Button (); descriptionLabel = new Label (); folderBrowserTreeViewContextMenu = new ContextMenu (); form.AcceptButton = okButton; form.CancelButton = cancelButton; form.SuspendLayout (); form.ClientSize = new Size (322, 324); form.MinimumSize = new Size (310, 254); form.Text = "Browse For Folder"; form.SizeGripStyle = SizeGripStyle.Show; newFolderMenuItem = new MenuItem("New Folder", new EventHandler (OnClickNewFolderButton)); folderBrowserTreeViewContextMenu.MenuItems.Add(newFolderMenuItem); // descriptionLabel descriptionLabel.Anchor = ((AnchorStyles)(((AnchorStyles.Top | AnchorStyles.Left) | AnchorStyles.Right))); descriptionLabel.Location = new Point (15, 14); descriptionLabel.Size = new Size (292, 40); descriptionLabel.TabIndex = 0; descriptionLabel.Text = string.Empty; // folderBrowserTreeView folderBrowserTreeView.Anchor = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right))); folderBrowserTreeView.ImageIndex = -1; folderBrowserTreeView.Location = new Point (15, 60); folderBrowserTreeView.SelectedImageIndex = -1; folderBrowserTreeView.Size = new Size (292, 212); folderBrowserTreeView.TabIndex = 3; folderBrowserTreeView.ShowLines = false; folderBrowserTreeView.ShowPlusMinus = true; folderBrowserTreeView.HotTracking = true; folderBrowserTreeView.BorderStyle = BorderStyle.Fixed3D; folderBrowserTreeView.ContextMenu = folderBrowserTreeViewContextMenu; //folderBrowserTreeView.Indent = 2; // newFolderButton newFolderButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Left))); newFolderButton.FlatStyle = FlatStyle.System; newFolderButton.Location = new Point (15, 285); newFolderButton.Size = new Size (105, 23); newFolderButton.TabIndex = 4; newFolderButton.Text = "Make New Folder"; newFolderButton.Enabled = true; // okButton okButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); okButton.FlatStyle = FlatStyle.System; okButton.Location = new Point (135, 285); okButton.Size = new Size (80, 23); okButton.TabIndex = 1; okButton.Text = "OK"; // cancelButton cancelButton.Anchor = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right))); cancelButton.DialogResult = DialogResult.Cancel; cancelButton.FlatStyle = FlatStyle.System; cancelButton.Location = new Point (227, 285); cancelButton.Size = new Size (80, 23); cancelButton.TabIndex = 2; cancelButton.Text = "Cancel"; form.Controls.Add (cancelButton); form.Controls.Add (okButton); form.Controls.Add (newFolderButton); form.Controls.Add (folderBrowserTreeView); form.Controls.Add (descriptionLabel); form.ResumeLayout (false); if (formConfigSize != Size.Empty) { form.Size = formConfigSize; } if (formConfigLocation != Point.Empty) { form.Location = formConfigLocation; } okButton.Click += new EventHandler (OnClickOKButton); cancelButton.Click += new EventHandler (OnClickCancelButton); newFolderButton.Click += new EventHandler (OnClickNewFolderButton); form.VisibleChanged += new EventHandler (OnFormVisibleChanged); RootFolder = rootFolder; }