Allows the interface implementer to initialize a form that will be used in the windows based designer.
public System.Windows.Form Form { get { return MyFormInitializationMethod(); } } public Form MyFormInitializationMethod() { // Create a new instance of the form. Form form1 = new Form(); // Create two buttons, a textbox and a label Button button1 = new Button (); Button button2 = new Button (); TextBox textbox1 = new TextBox(); Label label1 = new Label(); // set the caption of label1 to "My Prompt" label1.Caption = "My Prompt"; // Set the position of label1 label1.Location = new Point(10, 10); // Set the position of the textbox1 relative to label1 textbox1.Location = new Point (label1.Left, label1.Height + label1.Top + 10); // Set the text of button1 to "OK". button1.Text = "OK"; // Set the position of the button on the form. button1.Location = new Point (10, textbox1.Height + textbox1.Top + 10); // Set the text of button2 to "Cancel". button2.Text = "Cancel"; // Set the position of the button based on the location of button1. button2.Location = new Point (button1.Left + button1.Width + 10, button1.Top); // add label1 to the form. form1.Controls.Add(label1); // add textbox1 to the form. form1.Controls.Add(textbox1); // Add button1 to the form. form1.Controls.Add(button1); // Add button2 to the form. form1.Controls.Add(button2); return form1; }
Value
System.Windows.Form
Notes
Allows the implementer of the interface to return a Form to the system. Forms should be designed to display in the side window that is slid out by the designer. The width of this window is 400px. The default height of the form is 450px.