PageRenderTime 25ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 1ms

/WorldView/FormMessageBoxWithCheckBox.cs

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