Project Spiral

 

Check Boxes

Check boxes were created to provide the user the opportunity to select more than one option. Nothing happens until the user clicks on the Continue button at the bottom of the window. The group box is placed on the window template first and the three check boxes are placed onto the group box.

image from book
Figure 19-4: Check Boxes window

The user can pick any combination of the three check boxes (checked or unchecked, where a checked item has a black check mark in its box, and unchecked is blank). Once the user selections have been made, the Continue button is clicked to invoke the event handler. The code for this window is shown below:

Form4

 Form4.cs: SC0800:       #region Using directives               [7 lines, same as SC0002  SC0008] SC0808:       #endregion SC0809:       namespace StandardControls SC0810:       { SC0811:         partial class Form4 : Form SC0812:         { SC0813:           public Form4() SC0814:           {InitializeComponent(); } //-----------------------------------------------------------------------------------------// SC0820:           private void button1_Click(object sender, EventArgs e) SC0821:           { // Continue button. SC0822:             if (checkBox1.Checked)                       MessageBox.Show("You enabled 'Use Larger Font'."); SC0823:             if (checkBox2.Checked)                       MessageBox.Show("You enabled 'Print in Portrait Mode'."); SC0824:             if (checkBox3.Checked)                       MessageBox.Show("You enabled 'Include Corp. Disclaimer'."); SC0825:           } //-----------------------------------------------------------------------------------------// SC0830:           private void button2_Click(object sender, EventArgs e) SC0831:           { // Quit. SC0832:             Close(); SC0833:           } SC0834:         } SC0835:       } //=========================================================================================// Form4.Designer.cs: SC0900:       namespace StandardControls SC0901:       {                 [1 label, 1 groupBox, 3 checkBoxes, 2 buttons] SC0992:       } 
 


Unlocking Microsoft C# V 2.0 Programming Secrets
Unlocking Microsoft C# V 2.0 Programming Secrets (Wordware Applications Library)
ISBN: 1556220979
EAN: 2147483647
Year: 2005
Pages: 129

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net