123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202 |
- 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.ImageStitching
- {
- public delegate void DeleteHandler(int vIndex, int pIndex);
- public partial class ImageStitchingDetailDialog : PdnBaseForm
- {
- private List<Dictionary<int, object>> m_points;
- private int m_index;
- private DataGridViewTextBoxColumn Column1;
- private DataGridViewTextBoxColumn Column2;
- private DataGridViewTextBoxColumn Column3;
- private DataGridViewButtonColumn btnDel;
- private DataGridViewTextBoxColumn index;
- List<Dictionary<int, object>> keyValuePairs;
- public event DeleteHandler Deleted;
- public ImageStitchingDetailDialog(List<Dictionary<int, object>> points, int index)
- {
- this.m_points = points;
- this.m_index = index;
- InitializeComponent();
- InitializeLanguageText();
- //foreach (Dictionary<int, object> point in m_points)
- for (int i=0; i< m_points.Count; i++ )
- {
- Dictionary<int, object> point = m_points[i];
- //Console.WriteLine(point[1]);
- if (point[1].ToString().Equals("0"))
- {
- PointF pointF = (PointF)point[0];
- dgvPoints.Rows.Add(pointF.X, pointF.Y, 0, PdnResources.GetString("Menu.Edit.Delete.Text"), i);
- }
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- this.Close();
- }
- #region 控件
- 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);
- }
- // Windows Form Designer generated code
- private void InitializeLanguageText()
- {
- this.button1.Text = PdnResources.GetString("Menu.File.Close.Text");
- this.btnDel.HeaderText = PdnResources.GetString("Menu.operation.text");
- this.btnDel.Text = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.btnDel.ToolTipText = PdnResources.GetString("Menu.Edit.Delete.Text");
- this.Text = PdnResources.GetString("Menu.imagecapture.Imagestitching.zonesetting.text");
- }
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.dgvPoints = new System.Windows.Forms.DataGridView();
- this.button1 = new System.Windows.Forms.Button();
- this.Column1 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column2 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.Column3 = new System.Windows.Forms.DataGridViewTextBoxColumn();
- this.btnDel = new System.Windows.Forms.DataGridViewButtonColumn();
- this.index = new System.Windows.Forms.DataGridViewTextBoxColumn();
- ((System.ComponentModel.ISupportInitialize)(this.dgvPoints)).BeginInit();
- this.SuspendLayout();
- //
- // dgvPoints
- //
- this.dgvPoints.AllowUserToAddRows = false;
- this.dgvPoints.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
- this.dgvPoints.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
- this.dgvPoints.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
- this.Column1,
- this.Column2,
- this.Column3,
- this.btnDel,
- this.index});
- this.dgvPoints.Location = new System.Drawing.Point(12, 12);
- this.dgvPoints.Name = "dgvPoints";
- this.dgvPoints.RowHeadersVisible = false;
- this.dgvPoints.RowHeadersWidth = 51;
- this.dgvPoints.RowTemplate.Height = 27;
- this.dgvPoints.Size = new System.Drawing.Size(453, 314);
- this.dgvPoints.TabIndex = 0;
- this.dgvPoints.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvPoints_CellContentClick);
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(390, 341);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(75, 30);
- this.button1.TabIndex = 1;
- this.button1.UseVisualStyleBackColor = true;
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // Column1
- //
- this.Column1.HeaderText = "X";
- this.Column1.MinimumWidth = 6;
- this.Column1.Name = "Column1";
- //
- // Column2
- //
- this.Column2.HeaderText = "Y";
- this.Column2.MinimumWidth = 6;
- this.Column2.Name = "Column2";
- //
- // Column3
- //
- this.Column3.HeaderText = "Z";
- this.Column3.MinimumWidth = 6;
- this.Column3.Name = "Column3";
- //
- // btnDel
- //
- this.btnDel.MinimumWidth = 6;
- this.btnDel.Name = "btnDel";
- this.btnDel.Resizable = System.Windows.Forms.DataGridViewTriState.True;
- this.btnDel.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic;
-
- //
- // index
- //
- this.index.HeaderText = "index";
- this.index.MinimumWidth = 6;
- this.index.Name = "index";
- this.index.ReadOnly = true;
- this.index.Visible = false;
- //
- // DetailDialog
- //
- this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(477, 383);
- this.Controls.Add(this.button1);
- this.Controls.Add(this.dgvPoints);
- this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.MaximizeBox = false;
- this.MinimizeBox = false;
- this.Name = "DetailDialog";
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Controls.SetChildIndex(this.dgvPoints, 0);
- this.Controls.SetChildIndex(this.button1, 0);
- ((System.ComponentModel.ISupportInitialize)(this.dgvPoints)).EndInit();
- this.ResumeLayout(false);
- }
- private System.Windows.Forms.DataGridView dgvPoints;
- private System.Windows.Forms.Button button1;
- #endregion
- private void dgvPoints_CellContentClick(object sender, DataGridViewCellEventArgs e)
- {
- if (dgvPoints.Columns[e.ColumnIndex].Name == "btnDel" && e.RowIndex >= 0)
- {
- DialogResult result = MessageBox.Show(PdnResources.GetString("Menu.Areyousuretodelete.Text")+"?", PdnResources.GetString("Menu.Tips.text"), MessageBoxButtons.OKCancel);
- if (result == DialogResult.OK)
- {
- if (this.Deleted != null)
- {
- int pIndex = (int)dgvPoints.Rows[e.RowIndex].Cells[e.ColumnIndex + 1].Value;
- this.Deleted(m_index, pIndex);
- }
- dgvPoints.Rows.RemoveAt(e.RowIndex);
- }
- }
- }
- }
- }
|