PageRenderTime 70ms CodeModel.GetById 61ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/WorldView/FormMessageBoxWithCheckBox.cs

#
C# | 117 lines | 100 code | 16 blank | 1 comment | 7 complexity | 71d4c66465540f47744f9a122a8e6bf5 MD5 | raw file
  1using System;
  2using System.Drawing;
  3using System.Windows.Forms;
  4
  5namespace MoreTerra
  6{
  7	public partial class FormMessageBoxWithCheckBox : Form
  8	{
  9		private String lText;
 10		private String cbText;
 11		private String tText;
 12		private Point sPoint;
 13
 14		public FormMessageBoxWithCheckBox(String labelText, String checkBoxText, String titleText)
 15		{
 16			lText = labelText;
 17			cbText = checkBoxText;
 18			tText = titleText;
 19			sPoint.X = -1;
 20			sPoint.Y = -1;
 21
 22			this.ShowInTaskbar = false;
 23			InitializeComponent();
 24
 25			this.Icon = Properties.Resources.Cannon;
 26		}
 27
 28		private void FormMessageBoxWithCheckBox_Load(object sender, EventArgs e)
 29		{
 30			Point pt = new Point(0, 0);
 31			Size size;
 32
 33			labelDialogText.Text = lText;
 34			checkBoxDialogItem.Text = cbText;
 35			Text = tText;
 36
 37			// Set the box to the center of the window.
 38			if ((sPoint.X != -1) && (sPoint.Y != -1))
 39			{
 40				pt.X = sPoint.X - (this.Size.Width / 2);
 41				pt.Y = sPoint.Y - (this.Size.Height / 2);
 42				this.Location = pt;
 43			} else if (this.Owner != null)
 44			{
 45				pt = this.Owner.Location;
 46				size = this.Owner.Size;
 47
 48				pt.X = pt.X + (size.Width / 2) - (this.Size.Width / 2);
 49				pt.Y = pt.Y + (size.Height / 2) - (this.Size.Height / 2);
 50
 51				this.Location = pt;
 52			}
 53		}
 54
 55		private void buttonYes_Click(object sender, EventArgs e)
 56		{
 57			DialogResult = DialogResult.Yes;
 58		}
 59
 60		private void buttonNo_Click(object sender, EventArgs e)
 61		{
 62			DialogResult = DialogResult.No;
 63		}
 64
 65		public Boolean checkBoxChecked
 66		{
 67			get
 68			{
 69				return checkBoxDialogItem.Checked;
 70			}
 71			set
 72			{
 73				checkBoxDialogItem.Checked = value;
 74			}
 75		}
 76
 77		public String labelText
 78		{
 79			get
 80			{
 81				return labelDialogText.Text;
 82			}
 83			set
 84			{
 85				lText = value;
 86			}
 87		}
 88
 89		public String titleText
 90		{
 91			get
 92			{
 93				return Text;
 94			}
 95			set
 96			{
 97				tText = value;
 98			}
 99		}
100
101		public String checkBoxText
102		{
103			set
104			{
105				cbText = value;
106			}
107		}
108
109		public Point parentCenter
110		{
111			set
112			{
113				sPoint = value;
114			}
115		}
116	}
117}