C # Self-study Road 18

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.