123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- 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<int, object> point);
- public class ZModifyDialog : Form
- {
- #region
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.IContainer components = null;
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
- protected override void Dispose(bool disposing)
- {
- if (disposing && (components != null))
- {
- components.Dispose();
- }
- base.Dispose(disposing);
- }
- #region Windows Form Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- 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<int, object> m_point;
- private int m_index;
- public ZModifyDialog(int index, Dictionary<int, object> 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;
- }
- }
- }
|