//This section of the code creates the Splash Screen for the application //This part uses the Windows.Forms namespace (formerly WinForms) namespace AddressBook { using System; using System.Windows.Forms; using System.Drawing; public class mySplash : Form { LinkLabel myStart; //Shows Continue LinkLabel myExit; //Shows Exit Label myLabel; //Displays Address Book public mySplash() { this.FormBorderStyle = FormBorderStyle.FixedDialog; this.ClientSize = new Size(346 , 218); this.ControlBox = false; this.StartPosition = FormStartPosition.CenterScreen; myLabel = new Label(); myLabel.Text = "Address Book"; myLabel.AutoSize = true; myLabel.Location = new Point(92,80); myLabel.ForeColor = Color.SteelBlue; myLabel.Font = new Font("Microsoft Sans Serif" , 16f , FontStyle.Bold); this.Controls.Add(myLabel); myStart = new LinkLabel(); myStart.Text = "&Continue"; myStart.AutoSize = true; myStart.Location = new Point(230,200); myStart.Click += new EventHandler(onContinue); this.Controls.Add(myStart); myExit = new LinkLabel(); myExit.Text = "E&xit"; myExit.AutoSize = true; myExit.Location = new Point(300,200); myExit.Click += new EventHandler(onExit); this.Controls.Add(myExit); } //Event handler routine for Exit protected void onExit(Object mySender , EventArgs myArgs) { DialogResult myResult; myResult = MessageBox.Show("Are you sure to exit ?","Address Book",MessageBoxButtons.YesNo , MessageBoxIcon.Question); if (myResult == DialogResult.Yes) { this.Close(); Application.Exit(); } } //Event handler routine for Continue protected void onContinue(Object mySender , EventArgs myArgs) { this.Hide(); AddressList myList = new AddressList(); //Creates an instance of the AddressList form myList.Show(); //Displays the instance of the AddressList form } public static void Main() { Application.Run(new mySplash()); } } }