1 using System; 2 using System.ComponentModel; 3 using System.Drawing; 4 using System.Text; 5 using System.Windows.Forms; 6 7 namespace standardApplications 8 { 9 10 public partial class Form1 : Form 11 { 12 13 public Form1() 14 { 15 InitializeComponent(); 16 } 17 18 19 private void Form1_Load(object sender, EventArgs e) 20 { 21 try 22 { 23 this.Top = Program.Form1Top; 24 this.Left = Program.Form1Left; 25 this.Width = Program.Form1Width; 26 this.Height = Program.Form1Height; 27 this.Text = Application.ProductName + " " + Program.VersionShort; 28 29 if (Program.Form1Maximized) 30 WindowState = FormWindowState.Maximized; 31 32 this.Icon = new Icon(this.GetType(), "application.ico"); 33 34 this.BackColor = Program.Form1Backcolor; 35 36 aboutToolStripMenuItem.Text = "About " + Application.ProductName; 37 38 this.statusStrip1.Items[0].Text = 39 "Today is " + DateTime.Now.DayOfWeek.ToString(); 40 } 41 catch (Exception ex) 42 { 43 throw new Exception(ex.Message); 44 } 45 } 46 47 48 private void aboutToolStripMenuItem_Click(object sender, EventArgs e) 49 { 50 AboutForm myAboutForm = new AboutForm(); 51 myAboutForm.ShowDialog(); 52 } 53 54 55 private void exitToolStripMenuItem_Click(object sender, EventArgs e) 56 { 57 this.Close(); 58 } 59 60 61 private void Form1_FormClosing(object sender, FormClosingEventArgs e) 62 { 63 try 64 { 65 if (this.WindowState.Equals(FormWindowState.Maximized)) 66 { 67 Program.Form1Maximized = true; 68 } 69 else 70 { 71 Program.Form1Maximized = false; 72 Program.Form1Top = this.Top; 73 Program.Form1Left = this.Left; 74 Program.Form1Width = this.Width; 75 Program.Form1Height = this.Height; 76 } 77 } 78 catch (Exception ex) 79 { 80 throw new Exception(ex.Message); 81 } 82 } 83 84 85 } 86 }