CircleForm.cs 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299
  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. namespace GraphicalCS
  7. {
  8. /// <summary>
  9. /// CircleForm 的摘要说明。
  10. /// </summary>
  11. public class CircleForm : System.Windows.Forms.Form
  12. {
  13. internal System.Windows.Forms.Label lblCx;
  14. internal System.Windows.Forms.Label lblCy;
  15. internal System.Windows.Forms.Label lblR;
  16. private System.Windows.Forms.Button btnSubmit;
  17. private System.Windows.Forms.Button btnCancle;
  18. private Point start;
  19. private Point end;
  20. private float angle1;
  21. private float angle2;
  22. private bool boolvalue;
  23. internal System.Windows.Forms.TextBox CircleX;
  24. internal System.Windows.Forms.TextBox CircleY;
  25. internal System.Windows.Forms.TextBox CircleRadius;
  26. private System.Windows.Forms.Label AngleStart;
  27. private System.Windows.Forms.Label AngleEnd;
  28. private System.Windows.Forms.TextBox StartA;
  29. private System.Windows.Forms.TextBox LastA;
  30. public Point startP
  31. {
  32. get
  33. {
  34. return start;
  35. }
  36. }
  37. public Point endP
  38. {
  39. get
  40. {
  41. return end;
  42. }
  43. }
  44. public float FirstAngle
  45. {
  46. get
  47. {
  48. return angle1;
  49. }
  50. }
  51. public float EndAngle
  52. {
  53. get
  54. {
  55. return angle2;
  56. }
  57. }
  58. public bool cancle
  59. {
  60. get
  61. {
  62. return boolvalue;
  63. }
  64. }
  65. /// <summary>
  66. /// 必需的设计器变量。
  67. /// </summary>
  68. private System.ComponentModel.Container components = null;
  69. public CircleForm()
  70. {
  71. //
  72. // Windows 窗体设计器支持所必需的
  73. //
  74. InitializeComponent();
  75. //
  76. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  77. //
  78. }
  79. /// <summary>
  80. /// 清理所有正在使用的资源。
  81. /// </summary>
  82. protected override void Dispose( bool disposing )
  83. {
  84. if( disposing )
  85. {
  86. if(components != null)
  87. {
  88. components.Dispose();
  89. }
  90. }
  91. base.Dispose( disposing );
  92. }
  93. #region Windows 窗体设计器生成的代码
  94. /// <summary>
  95. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  96. /// 此方法的内容。
  97. /// </summary>
  98. private void InitializeComponent()
  99. {
  100. this.lblCx = new System.Windows.Forms.Label();
  101. this.lblCy = new System.Windows.Forms.Label();
  102. this.lblR = new System.Windows.Forms.Label();
  103. this.CircleX = new System.Windows.Forms.TextBox();
  104. this.CircleY = new System.Windows.Forms.TextBox();
  105. this.CircleRadius = new System.Windows.Forms.TextBox();
  106. this.btnSubmit = new System.Windows.Forms.Button();
  107. this.btnCancle = new System.Windows.Forms.Button();
  108. this.AngleStart = new System.Windows.Forms.Label();
  109. this.AngleEnd = new System.Windows.Forms.Label();
  110. this.StartA = new System.Windows.Forms.TextBox();
  111. this.LastA = new System.Windows.Forms.TextBox();
  112. this.SuspendLayout();
  113. //
  114. // lblCx
  115. //
  116. this.lblCx.Location = new System.Drawing.Point(24, 16);
  117. this.lblCx.Name = "lblCx";
  118. this.lblCx.Size = new System.Drawing.Size(67, 17);
  119. this.lblCx.TabIndex = 5;
  120. this.lblCx.Text = "Center X";
  121. this.lblCx.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  122. //
  123. // lblCy
  124. //
  125. this.lblCy.Location = new System.Drawing.Point(24, 48);
  126. this.lblCy.Name = "lblCy";
  127. this.lblCy.Size = new System.Drawing.Size(67, 17);
  128. this.lblCy.TabIndex = 7;
  129. this.lblCy.Text = "Center Y";
  130. this.lblCy.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  131. //
  132. // lblR
  133. //
  134. this.lblR.Location = new System.Drawing.Point(24, 80);
  135. this.lblR.Name = "lblR";
  136. this.lblR.Size = new System.Drawing.Size(67, 17);
  137. this.lblR.TabIndex = 9;
  138. this.lblR.Text = "Radius";
  139. this.lblR.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
  140. //
  141. // CircleX
  142. //
  143. this.CircleX.Location = new System.Drawing.Point(120, 16);
  144. this.CircleX.Name = "CircleX";
  145. this.CircleX.Size = new System.Drawing.Size(48, 21);
  146. this.CircleX.TabIndex = 10;
  147. this.CircleX.Text = "0";
  148. this.CircleX.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CircleX_KeyPress);
  149. //
  150. // CircleY
  151. //
  152. this.CircleY.Location = new System.Drawing.Point(120, 48);
  153. this.CircleY.Name = "CircleY";
  154. this.CircleY.Size = new System.Drawing.Size(48, 21);
  155. this.CircleY.TabIndex = 11;
  156. this.CircleY.Text = "0";
  157. this.CircleY.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CircleY_KeyPress);
  158. //
  159. // CircleRadius
  160. //
  161. this.CircleRadius.Location = new System.Drawing.Point(120, 80);
  162. this.CircleRadius.Name = "CircleRadius";
  163. this.CircleRadius.Size = new System.Drawing.Size(48, 21);
  164. this.CircleRadius.TabIndex = 12;
  165. this.CircleRadius.Text = "0";
  166. this.CircleRadius.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.CircleRadius_KeyPress);
  167. //
  168. // btnSubmit
  169. //
  170. this.btnSubmit.Location = new System.Drawing.Point(192, 56);
  171. this.btnSubmit.Name = "btnSubmit";
  172. this.btnSubmit.TabIndex = 13;
  173. this.btnSubmit.Text = "Submit";
  174. this.btnSubmit.Click += new System.EventHandler(this.btnSubmit_Click);
  175. //
  176. // btnCancle
  177. //
  178. this.btnCancle.Location = new System.Drawing.Point(192, 104);
  179. this.btnCancle.Name = "btnCancle";
  180. this.btnCancle.TabIndex = 14;
  181. this.btnCancle.Text = "Cancle";
  182. this.btnCancle.Click += new System.EventHandler(this.btnCancle_Click);
  183. //
  184. // AngleStart
  185. //
  186. this.AngleStart.Location = new System.Drawing.Point(24, 112);
  187. this.AngleStart.Name = "AngleStart";
  188. this.AngleStart.Size = new System.Drawing.Size(67, 17);
  189. this.AngleStart.TabIndex = 15;
  190. this.AngleStart.Text = "AngleX";
  191. //
  192. // AngleEnd
  193. //
  194. this.AngleEnd.Location = new System.Drawing.Point(24, 144);
  195. this.AngleEnd.Name = "AngleEnd";
  196. this.AngleEnd.Size = new System.Drawing.Size(67, 17);
  197. this.AngleEnd.TabIndex = 16;
  198. this.AngleEnd.Text = "AngleLast";
  199. //
  200. // StartA
  201. //
  202. this.StartA.Location = new System.Drawing.Point(120, 112);
  203. this.StartA.Name = "StartA";
  204. this.StartA.Size = new System.Drawing.Size(48, 21);
  205. this.StartA.TabIndex = 17;
  206. this.StartA.Text = "0";
  207. this.StartA.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.StartA_KeyPress);
  208. //
  209. // LastA
  210. //
  211. this.LastA.Location = new System.Drawing.Point(120, 144);
  212. this.LastA.Name = "LastA";
  213. this.LastA.Size = new System.Drawing.Size(48, 21);
  214. this.LastA.TabIndex = 18;
  215. this.LastA.Text = "0";
  216. this.LastA.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.LastA_KeyPress);
  217. //
  218. // CircleForm
  219. //
  220. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  221. this.ClientSize = new System.Drawing.Size(304, 182);
  222. this.Controls.Add(this.LastA);
  223. this.Controls.Add(this.StartA);
  224. this.Controls.Add(this.AngleEnd);
  225. this.Controls.Add(this.AngleStart);
  226. this.Controls.Add(this.btnCancle);
  227. this.Controls.Add(this.btnSubmit);
  228. this.Controls.Add(this.CircleRadius);
  229. this.Controls.Add(this.CircleY);
  230. this.Controls.Add(this.CircleX);
  231. this.Controls.Add(this.lblR);
  232. this.Controls.Add(this.lblCy);
  233. this.Controls.Add(this.lblCx);
  234. this.Name = "CircleForm";
  235. this.Text = "CircleForm";
  236. this.ResumeLayout(false);
  237. }
  238. #endregion
  239. private void btnSubmit_Click(object sender, System.EventArgs e)
  240. {
  241. boolvalue = false;
  242. start.X = Convert.ToInt32(this.CircleX.Text);
  243. start.Y = Convert.ToInt32(this.CircleY.Text);
  244. end.X = Convert.ToInt32(this.CircleX.Text) + Convert.ToInt32(this.CircleRadius.Text);
  245. end.Y = start.Y;
  246. if((start.X==end.X)&&(end.Y==end.Y))
  247. end.Y += 1;
  248. angle1 = Convert.ToSingle(this.StartA.Text);
  249. angle2 = Convert.ToSingle(this.LastA.Text);
  250. this.Hide();
  251. }
  252. private void btnCancle_Click(object sender, System.EventArgs e)
  253. {
  254. boolvalue = true;
  255. this.Hide();
  256. }
  257. private void CircleX_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
  258. {
  259. if((e.KeyChar<48||e.KeyChar>57)&&e.KeyChar!=8)
  260. e.Handled = true;
  261. }
  262. private void CircleY_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
  263. {
  264. if((e.KeyChar<48||e.KeyChar>57)&&e.KeyChar!=8)
  265. e.Handled = true;
  266. }
  267. private void CircleRadius_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
  268. {
  269. if((e.KeyChar<48||e.KeyChar>57)&&e.KeyChar!=8)
  270. e.Handled = true;
  271. }
  272. private void StartA_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
  273. {
  274. if((e.KeyChar<48||e.KeyChar>57)&&e.KeyChar!=8)
  275. e.Handled = true;
  276. }
  277. private void LastA_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
  278. {
  279. if((e.KeyChar<48||e.KeyChar>57)&&e.KeyChar!=8)
  280. e.Handled = true;
  281. }
  282. }
  283. }