18.windows window
A window is the basic unit of a Windows application, a screen area that is used to present information to the user and to accept user input. The window is like a container, and other interface elements can be placed in the window.
The basic properties of the Windows window.
1. Window's Name property (name)
2. Title Property of the window (text)
3. Window Control Menu Properties: ControlBox property, True Display Control menu, False does not display menu.
MaximizeBox property, Maximize button.
The MinimizeBox property, minimized button.
4. Window appearance properties: Formborderstyle,size,location,backcolor,backgroundimage,opacity.
Sets the properties of the Startup window.
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/5F/99/wKioL1UqLSeAg2rMAAJAYakygWA752.jpg "title="% Sslo3b7 ' W~]MD ' _89 (]5xi.png "alt=" Wkiol1uqlseag2rmaajayakygwa752.jpg "/>
Modifying the Application.Run (new + window name ()) will start the specified window first.
Click the button on the Form2 to hide the Form2 window and display the Form1 window.
Namespace Calculator
{
public partial class Form2:form
{
Public Form2 ()
{
InitializeComponent ();
}
private void Button1_Click (object sender, EventArgs e)
{
Form1 Form1 = new Form1 ();
Form1. Show ();
This. Hide ();
}
}
}
The event for the window. Click, load, and close the event.
private void Form2_click (object sender, EventArgs e)
{
MessageBox.Show ("Clicked on the window!!! " );
}
private void Form2_load (object sender, EventArgs e)
{
This. Width = 1000;
This. Height = 500;
This. Text = "welcome!";
}
private void Form2_formclosing (object sender, FormClosingEventArgs e)
{
DialogResult dr = MessageBox.Show ("Do you want to close the window?" "," hint ", messageboxbuttons.yesno,messageboxicon.warning);
if (dr = = Dialogresult.yes)
{
E.cancel = false;
}
Else
{
E.cancel = true;
}
}
}
; 650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/5F/9B/wKioL1UqMu-TJnHFAADLAoqPAxg430.jpg "title=" r0$% zhpknmc4n) o8e3vy64i.jpg "alt=" Wkiol1uqmu-tjnhfaadlaoqpaxg430.jpg "/>
This article from "Very blog" blog, reproduced please contact the author!
C # Self-study Road 18