using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace PaintDotNet.ImageCollect.ListOfLocation { public delegate void ModifyHandler(int vIndex, Dictionary point); public class ZModifyDialog : Form { #region /// /// Required designer variable. /// private System.ComponentModel.IContainer components = null; /// /// Clean up any resources being used. /// /// true if managed resources should be disposed; otherwise, false. protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// private void InitializeComponent() { this.label1 = new System.Windows.Forms.Label(); this.lblX = new System.Windows.Forms.Label(); this.lblY = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.textBox1 = new System.Windows.Forms.TextBox(); this.button1 = new System.Windows.Forms.Button(); this.SuspendLayout(); // // label1 // this.label1.AutoSize = true; this.label1.Location = new System.Drawing.Point(35, 33); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(52, 15); this.label1.TabIndex = 0; // // lblX // this.lblX.AutoSize = true; this.lblX.Location = new System.Drawing.Point(103, 33); this.lblX.Name = "lblX"; this.lblX.Size = new System.Drawing.Size(23, 15); this.lblX.TabIndex = 1; this.lblX.Text = "X:"; // // lblY // this.lblY.AutoSize = true; this.lblY.Location = new System.Drawing.Point(103, 74); this.lblY.Name = "lblY"; this.lblY.Size = new System.Drawing.Size(23, 15); this.lblY.TabIndex = 2; this.lblY.Text = "Y:"; // // label2 // this.label2.AutoSize = true; this.label2.Location = new System.Drawing.Point(103, 114); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(23, 15); this.label2.TabIndex = 3; this.label2.Text = "Z:"; // // textBox1 // this.textBox1.Location = new System.Drawing.Point(147, 111); this.textBox1.Name = "textBox1"; this.textBox1.Size = new System.Drawing.Size(104, 25); this.textBox1.TabIndex = 4; this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress); // // button1 // this.button1.Location = new System.Drawing.Point(147, 183); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(75, 27); this.button1.TabIndex = 5; this.button1.UseVisualStyleBackColor = true; this.button1.Click += new System.EventHandler(this.button1_Click); // // ZModifyDialog // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(380, 264); this.Controls.Add(this.button1); this.Controls.Add(this.textBox1); this.Controls.Add(this.label2); this.Controls.Add(this.lblY); this.Controls.Add(this.lblX); this.Controls.Add(this.label1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ZModifyDialog"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.ResumeLayout(false); this.PerformLayout(); } #endregion private System.Windows.Forms.Label label1; private System.Windows.Forms.Label lblX; private System.Windows.Forms.Label lblY; private System.Windows.Forms.Label label2; private System.Windows.Forms.TextBox textBox1; private System.Windows.Forms.Button button1; #endregion public event ModifyHandler Modified; private Dictionary m_point; private int m_index; public ZModifyDialog(int index, Dictionary point) { m_index = index; m_point = point; InitializeComponent(); this.label1.Text = PdnResources.GetString("Menu.position.text") + ":"; this.button1.Text = PdnResources.GetString("Menu.ensure.text"); this.Text = PdnResources.GetString("Menu.modify.Text") + PdnResources.GetString("Menu.Hardwantrol.Locatavtion.Zaxisposition.text"); lblX.Text = "X:" + ((PointF)m_point[0]).X; lblY.Text = "Y:" + ((PointF)m_point[0]).Y; textBox1.Text = m_point[1].ToString(); } private void button1_Click(object sender, EventArgs e) { if(textBox1.Text.Trim().Length == 0) { MessageBox.Show(PdnResources.GetString("Menu.Pleasethaxisposition.Text")); return; } m_point[1] = textBox1.Text.Trim(); if (Modified != null) { Modified(m_index, m_point); } this.Close(); } private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { TextBox textBox = (TextBox)sender; if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8 && (int)e.KeyChar != 45) e.Handled = true; } } }