using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; namespace m { /// /// Summary description for CaPropForm. /// public class CaPropForm : System.Windows.Forms.Form { private System.Windows.Forms.PropertyGrid propertyGrid1; private System.Windows.Forms.Button buttonOk; /// /// Required designer variable. /// private System.ComponentModel.Container components = null; public CaPropForm(CaType cat) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // propertyGrid1.SelectedObject = cat; propertyGrid1.ExpandAllGridItems(); } /// /// Clean up any resources being used. /// protected override void Dispose( bool disposing ) { if( disposing ) { if(components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.propertyGrid1 = new System.Windows.Forms.PropertyGrid(); this.buttonOk = new System.Windows.Forms.Button(); this.SuspendLayout(); // // propertyGrid1 // this.propertyGrid1.CommandsVisibleIfAvailable = true; this.propertyGrid1.LargeButtons = false; this.propertyGrid1.LineColor = System.Drawing.SystemColors.ScrollBar; this.propertyGrid1.Name = "propertyGrid1"; this.propertyGrid1.Size = new System.Drawing.Size(296, 256); this.propertyGrid1.TabIndex = 0; this.propertyGrid1.Text = "propertyGrid1"; this.propertyGrid1.ToolbarVisible = false; this.propertyGrid1.ViewBackColor = System.Drawing.SystemColors.Window; this.propertyGrid1.ViewForeColor = System.Drawing.SystemColors.WindowText; // // buttonOk // this.buttonOk.Location = new System.Drawing.Point(112, 268); this.buttonOk.Name = "buttonOk"; this.buttonOk.TabIndex = 1; this.buttonOk.Text = "Ok"; this.buttonOk.Click += new System.EventHandler(this.buttonOk_Click); // // CaPropForm // this.AcceptButton = this.buttonOk; this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(296, 302); this.ControlBox = false; this.Controls.AddRange(new System.Windows.Forms.Control[] { this.buttonOk, this.propertyGrid1}); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "CaPropForm"; this.ShowInTaskbar = false; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "Properties"; this.ResumeLayout(false); } #endregion public static bool DoModal(CaType cat) { CaPropForm frm = new CaPropForm(cat); DialogResult res = frm.ShowDialog(); return res == DialogResult.OK; } private void buttonOk_Click(object sender, System.EventArgs e) { DialogResult = DialogResult.OK; } private void buttonCancel_Click(object sender, System.EventArgs e) { DialogResult = DialogResult.Cancel; } } }