ZModifyDialog.cs 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace PaintDotNet.ImageCollect.ListOfLocation
  11. {
  12. public delegate void ModifyHandler(int vIndex, Dictionary<int, object> point);
  13. public class ZModifyDialog : Form
  14. {
  15. #region
  16. /// <summary>
  17. /// Required designer variable.
  18. /// </summary>
  19. private System.ComponentModel.IContainer components = null;
  20. /// <summary>
  21. /// Clean up any resources being used.
  22. /// </summary>
  23. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  24. protected override void Dispose(bool disposing)
  25. {
  26. if (disposing && (components != null))
  27. {
  28. components.Dispose();
  29. }
  30. base.Dispose(disposing);
  31. }
  32. #region Windows Form Designer generated code
  33. /// <summary>
  34. /// Required method for Designer support - do not modify
  35. /// the contents of this method with the code editor.
  36. /// </summary>
  37. private void InitializeComponent()
  38. {
  39. this.label1 = new System.Windows.Forms.Label();
  40. this.lblX = new System.Windows.Forms.Label();
  41. this.lblY = new System.Windows.Forms.Label();
  42. this.label2 = new System.Windows.Forms.Label();
  43. this.textBox1 = new System.Windows.Forms.TextBox();
  44. this.button1 = new System.Windows.Forms.Button();
  45. this.SuspendLayout();
  46. //
  47. // label1
  48. //
  49. this.label1.AutoSize = true;
  50. this.label1.Location = new System.Drawing.Point(35, 33);
  51. this.label1.Name = "label1";
  52. this.label1.Size = new System.Drawing.Size(52, 15);
  53. this.label1.TabIndex = 0;
  54. //
  55. // lblX
  56. //
  57. this.lblX.AutoSize = true;
  58. this.lblX.Location = new System.Drawing.Point(103, 33);
  59. this.lblX.Name = "lblX";
  60. this.lblX.Size = new System.Drawing.Size(23, 15);
  61. this.lblX.TabIndex = 1;
  62. this.lblX.Text = "X:";
  63. //
  64. // lblY
  65. //
  66. this.lblY.AutoSize = true;
  67. this.lblY.Location = new System.Drawing.Point(103, 74);
  68. this.lblY.Name = "lblY";
  69. this.lblY.Size = new System.Drawing.Size(23, 15);
  70. this.lblY.TabIndex = 2;
  71. this.lblY.Text = "Y:";
  72. //
  73. // label2
  74. //
  75. this.label2.AutoSize = true;
  76. this.label2.Location = new System.Drawing.Point(103, 114);
  77. this.label2.Name = "label2";
  78. this.label2.Size = new System.Drawing.Size(23, 15);
  79. this.label2.TabIndex = 3;
  80. this.label2.Text = "Z:";
  81. //
  82. // textBox1
  83. //
  84. this.textBox1.Location = new System.Drawing.Point(147, 111);
  85. this.textBox1.Name = "textBox1";
  86. this.textBox1.Size = new System.Drawing.Size(104, 25);
  87. this.textBox1.TabIndex = 4;
  88. this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
  89. //
  90. // button1
  91. //
  92. this.button1.Location = new System.Drawing.Point(147, 183);
  93. this.button1.Name = "button1";
  94. this.button1.Size = new System.Drawing.Size(75, 27);
  95. this.button1.TabIndex = 5;
  96. this.button1.UseVisualStyleBackColor = true;
  97. this.button1.Click += new System.EventHandler(this.button1_Click);
  98. //
  99. // ZModifyDialog
  100. //
  101. this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
  102. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  103. this.ClientSize = new System.Drawing.Size(380, 264);
  104. this.Controls.Add(this.button1);
  105. this.Controls.Add(this.textBox1);
  106. this.Controls.Add(this.label2);
  107. this.Controls.Add(this.lblY);
  108. this.Controls.Add(this.lblX);
  109. this.Controls.Add(this.label1);
  110. this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
  111. this.MaximizeBox = false;
  112. this.MinimizeBox = false;
  113. this.Name = "ZModifyDialog";
  114. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
  115. this.ResumeLayout(false);
  116. this.PerformLayout();
  117. }
  118. #endregion
  119. private System.Windows.Forms.Label label1;
  120. private System.Windows.Forms.Label lblX;
  121. private System.Windows.Forms.Label lblY;
  122. private System.Windows.Forms.Label label2;
  123. private System.Windows.Forms.TextBox textBox1;
  124. private System.Windows.Forms.Button button1;
  125. #endregion
  126. public event ModifyHandler Modified;
  127. private Dictionary<int, object> m_point;
  128. private int m_index;
  129. public ZModifyDialog(int index, Dictionary<int, object> point)
  130. {
  131. m_index = index;
  132. m_point = point;
  133. InitializeComponent();
  134. this.label1.Text = PdnResources.GetString("Menu.position.text") + ":";
  135. this.button1.Text = PdnResources.GetString("Menu.ensure.text");
  136. this.Text = PdnResources.GetString("Menu.modify.Text") + PdnResources.GetString("Menu.Hardwantrol.Locatavtion.Zaxisposition.text");
  137. lblX.Text = "X:" + ((PointF)m_point[0]).X;
  138. lblY.Text = "Y:" + ((PointF)m_point[0]).Y;
  139. textBox1.Text = m_point[1].ToString();
  140. }
  141. private void button1_Click(object sender, EventArgs e)
  142. {
  143. if(textBox1.Text.Trim().Length == 0)
  144. {
  145. MessageBox.Show(PdnResources.GetString("Menu.Pleasethaxisposition.Text"));
  146. return;
  147. }
  148. m_point[1] = textBox1.Text.Trim();
  149. if (Modified != null)
  150. {
  151. Modified(m_index, m_point);
  152. }
  153. this.Close();
  154. }
  155. private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
  156. {
  157. TextBox textBox = (TextBox)sender;
  158. if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8 && (int)e.KeyChar != 45)
  159. e.Handled = true;
  160. }
  161. }
  162. }