PageRenderTime 102ms CodeModel.GetById 60ms app.highlight 4ms RepoModel.GetById 36ms app.codeStats 0ms

/WorldView/FormEntryBox.cs

#
C# | 95 lines | 79 code | 15 blank | 1 comment | 2 complexity | f7f5525c7086cf0376f6e823af2ef693 MD5 | raw file
 1using System;
 2using System.Drawing;
 3using System.Windows.Forms;
 4
 5namespace MoreTerra
 6{
 7	public partial class FormEntryBox : Form
 8	{
 9		private String fText;
10		private String lText;
11		private String iText;
12
13		#region Constructors
14		public FormEntryBox()
15		{
16			this.Icon = Properties.Resources.Cannon;
17			this.ShowInTaskbar = false;
18			InitializeComponent();
19		}
20		#endregion
21
22		#region Event Handlers
23		private void FormEntryBox_Load(object sender, EventArgs e)
24		{
25			Point pt;
26			Size size;
27			this.Text = fText;
28			this.labelMessage.Text = lText;
29			textBoxItem.Text = iText;
30
31			// Set the box to the center of the window.
32			pt = this.Owner.Location;
33			size = this.Owner.Size;
34
35			pt.X = pt.X + (size.Width / 2) - (this.Size.Width / 2);
36			pt.Y = pt.Y + (size.Height / 2) - (this.Size.Height / 2);
37
38			this.Location = pt;
39		}
40
41		private void FormEntryBox_Shown(object sender, EventArgs e)
42		{
43			textBoxItem.Focus();
44		}
45
46		private void buttonOk_Click(object sender, EventArgs e)
47		{
48			if (textBoxItem.Text == "")
49			{
50				DialogResult = DialogResult.Cancel;
51				return;
52			}
53
54			DialogResult = DialogResult.OK;
55		}
56
57		private void buttonCancel_Click(object sender, EventArgs e)
58		{
59			DialogResult = DialogResult.Cancel;
60		}
61		#endregion
62
63		#region GetSet Functions
64		public String EntryItem
65		{
66			get
67			{
68				return textBoxItem.Text;
69			}
70			set
71			{
72				iText = value;
73			}
74		}
75
76		public String LabelText
77		{
78			set
79			{
80				lText = value;
81			}
82		}
83
84		public String FormText
85		{
86			set
87			{
88				fText = value;
89			}
90		}
91		#endregion
92
93
94	}
95}