relayout form

This commit is contained in:
Samuele E. Locatelli
2021-02-09 18:20:20 +01:00
parent 4d847c2add
commit f1b3a90c2e
2 changed files with 117 additions and 119 deletions
+107 -96
View File
@@ -37,11 +37,8 @@
this.recorderToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripConnectionStatus = new System.Windows.Forms.ToolStripStatusLabel();
this.panel1 = new System.Windows.Forms.Panel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.panel2 = new System.Windows.Forms.Panel();
this.pictureBox2 = new System.Windows.Forms.PictureBox();
this.panel3 = new System.Windows.Forms.Panel();
this.pBoxOrig = new System.Windows.Forms.PictureBox();
this.panelCmd = new System.Windows.Forms.Panel();
this.chkPointSetup = new System.Windows.Forms.CheckBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.label5 = new System.Windows.Forms.Label();
@@ -59,16 +56,19 @@
this.chkReadTemp = new System.Windows.Forms.CheckBox();
this.lblReadTemp = new System.Windows.Forms.Label();
this.lblPoint = new System.Windows.Forms.Label();
this.chkZoom = new System.Windows.Forms.CheckBox();
this.pBoxTraBn = new System.Windows.Forms.PictureBox();
this.pBoxTraCol = new System.Windows.Forms.PictureBox();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.menuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit();
this.panel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pBoxOrig)).BeginInit();
this.panelCmd.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pBoxTraBn)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pBoxTraCol)).BeginInit();
this.SuspendLayout();
//
// menuStrip1
@@ -78,7 +78,7 @@
this.cameraToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(1499, 24);
this.menuStrip1.Size = new System.Drawing.Size(1290, 24);
this.menuStrip1.TabIndex = 0;
this.menuStrip1.Text = "menuStrip1";
//
@@ -133,9 +133,9 @@
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripConnectionStatus});
this.statusStrip1.Location = new System.Drawing.Point(0, 543);
this.statusStrip1.Location = new System.Drawing.Point(0, 793);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(1499, 22);
this.statusStrip1.Size = new System.Drawing.Size(1290, 22);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
//
@@ -145,62 +145,34 @@
this.toolStripConnectionStatus.Size = new System.Drawing.Size(79, 17);
this.toolStripConnectionStatus.Text = "Disconnected";
//
// panel1
// pBoxOrig
//
this.panel1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Location = new System.Drawing.Point(3, 23);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(650, 516);
this.panel1.TabIndex = 5;
this.pBoxOrig.Location = new System.Drawing.Point(198, 57);
this.pBoxOrig.Name = "pBoxOrig";
this.pBoxOrig.Size = new System.Drawing.Size(750, 600);
this.pBoxOrig.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pBoxOrig.TabIndex = 3;
this.pBoxOrig.TabStop = false;
this.pBoxOrig.Click += new System.EventHandler(this.pictureBox1_Click);
//
// pictureBox1
// panelCmd
//
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(640, 512);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox1.TabIndex = 3;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
//
// panel2
//
this.panel2.Anchor = System.Windows.Forms.AnchorStyles.None;
this.panel2.Controls.Add(this.pictureBox2);
this.panel2.Location = new System.Drawing.Point(851, 23);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(644, 516);
this.panel2.TabIndex = 6;
//
// pictureBox2
//
this.pictureBox2.Location = new System.Drawing.Point(0, 0);
this.pictureBox2.Name = "pictureBox2";
this.pictureBox2.Size = new System.Drawing.Size(640, 512);
this.pictureBox2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBox2.TabIndex = 5;
this.pictureBox2.TabStop = false;
//
// panel3
//
this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)));
this.panel3.BackColor = System.Drawing.SystemColors.ControlDark;
this.panel3.Controls.Add(this.chkZoom);
this.panel3.Controls.Add(this.lblPoint);
this.panel3.Controls.Add(this.lblReadTemp);
this.panel3.Controls.Add(this.chkReadTemp);
this.panel3.Controls.Add(this.chkPointSetup);
this.panel3.Controls.Add(this.groupBox2);
this.panel3.Controls.Add(this.groupBox1);
this.panel3.Controls.Add(this.checkLive);
this.panel3.Controls.Add(this.btnAcquire);
this.panel3.Controls.Add(this.labelTitle);
this.panel3.Location = new System.Drawing.Point(651, 23);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(192, 517);
this.panel3.TabIndex = 6;
this.panelCmd.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)));
this.panelCmd.BackColor = System.Drawing.SystemColors.ControlDark;
this.panelCmd.Controls.Add(this.lblPoint);
this.panelCmd.Controls.Add(this.lblReadTemp);
this.panelCmd.Controls.Add(this.chkReadTemp);
this.panelCmd.Controls.Add(this.chkPointSetup);
this.panelCmd.Controls.Add(this.groupBox2);
this.panelCmd.Controls.Add(this.groupBox1);
this.panelCmd.Controls.Add(this.checkLive);
this.panelCmd.Controls.Add(this.btnAcquire);
this.panelCmd.Controls.Add(this.labelTitle);
this.panelCmd.Location = new System.Drawing.Point(0, 23);
this.panelCmd.Name = "panelCmd";
this.panelCmd.Size = new System.Drawing.Size(192, 767);
this.panelCmd.TabIndex = 6;
//
// chkPointSetup
//
@@ -241,7 +213,7 @@
this.txtBC.Name = "txtBC";
this.txtBC.Size = new System.Drawing.Size(100, 20);
this.txtBC.TabIndex = 4;
this.txtBC.Text = "800";
this.txtBC.Text = "512";
this.txtBC.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.txtBC.TextChanged += new System.EventHandler(this.txtBC_TextChanged);
//
@@ -260,7 +232,7 @@
this.txtAB.Name = "txtAB";
this.txtAB.Size = new System.Drawing.Size(100, 20);
this.txtAB.TabIndex = 0;
this.txtAB.Text = "1200";
this.txtAB.Text = "640";
this.txtAB.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.txtAB.TextChanged += new System.EventHandler(this.txtAB_TextChanged);
//
@@ -375,27 +347,66 @@
this.lblPoint.TabIndex = 9;
this.lblPoint.Text = "(0,0)";
//
// chkZoom
// pBoxTraBn
//
this.chkZoom.AutoSize = true;
this.chkZoom.Checked = true;
this.chkZoom.CheckState = System.Windows.Forms.CheckState.Checked;
this.chkZoom.Location = new System.Drawing.Point(8, 56);
this.chkZoom.Name = "chkZoom";
this.chkZoom.Size = new System.Drawing.Size(69, 17);
this.chkZoom.TabIndex = 10;
this.chkZoom.Text = "Zoom 2X";
this.chkZoom.UseVisualStyleBackColor = true;
this.chkZoom.CheckedChanged += new System.EventHandler(this.chkZoom_CheckedChanged);
this.pBoxTraBn.Location = new System.Drawing.Point(954, 57);
this.pBoxTraBn.Name = "pBoxTraBn";
this.pBoxTraBn.Size = new System.Drawing.Size(320, 256);
this.pBoxTraBn.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pBoxTraBn.TabIndex = 7;
this.pBoxTraBn.TabStop = false;
//
// pBoxTraCol
//
this.pBoxTraCol.Location = new System.Drawing.Point(954, 401);
this.pBoxTraCol.Name = "pBoxTraCol";
this.pBoxTraCol.Size = new System.Drawing.Size(320, 256);
this.pBoxTraCol.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pBoxTraCol.TabIndex = 8;
this.pBoxTraCol.TabStop = false;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Verdana", 14F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(199, 23);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(192, 23);
this.label2.TabIndex = 9;
this.label2.Text = "ORIGINAL image";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Verdana", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.Location = new System.Drawing.Point(950, 31);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(177, 23);
this.label3.TabIndex = 10;
this.label3.Text = "RESCALED image";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Verdana", 14F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.Location = new System.Drawing.Point(950, 375);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(194, 23);
this.label4.TabIndex = 11;
this.label4.Text = "RECOLORED image";
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1499, 565);
this.Controls.Add(this.panel3);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
this.ClientSize = new System.Drawing.Size(1290, 815);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.label2);
this.Controls.Add(this.pBoxTraCol);
this.Controls.Add(this.pBoxTraBn);
this.Controls.Add(this.pBoxOrig);
this.Controls.Add(this.panelCmd);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
@@ -407,16 +418,15 @@
this.menuStrip1.PerformLayout();
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.panel1.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit();
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pBoxOrig)).EndInit();
this.panelCmd.ResumeLayout(false);
this.panelCmd.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pBoxTraBn)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.pBoxTraCol)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -433,11 +443,8 @@
private System.Windows.Forms.ToolStripStatusLabel toolStripConnectionStatus;
private System.Windows.Forms.ToolStripMenuItem disconnectToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.PictureBox pictureBox2;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.PictureBox pBoxOrig;
private System.Windows.Forms.Panel panelCmd;
private System.Windows.Forms.Label labelTitle;
private System.Windows.Forms.CheckBox checkLive;
private System.Windows.Forms.Button btnAcquire;
@@ -455,7 +462,11 @@
private System.Windows.Forms.CheckBox chkReadTemp;
private System.Windows.Forms.Label lblReadTemp;
private System.Windows.Forms.Label lblPoint;
private System.Windows.Forms.CheckBox chkZoom;
private System.Windows.Forms.PictureBox pBoxTraBn;
private System.Windows.Forms.PictureBox pBoxTraCol;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
}
}
+10 -23
View File
@@ -68,7 +68,6 @@ namespace ThermalImageStreamerDemo
_timerRefreshUi.Tick += _timerRefreshUi_Tick;
// calcolo i destPoints
updateDestPt();
setPictureScale();
}
void _timerRefreshUi_Tick(object sender, EventArgs e)
@@ -92,7 +91,7 @@ namespace ThermalImageStreamerDemo
try
{
lastImage = (ThermalImage)_camera.GetImage();
pictureBox1.Image = lastImage.Image;
pBoxOrig.Image = lastImage.Image;
}
catch (Exception exception)
@@ -262,7 +261,7 @@ namespace ThermalImageStreamerDemo
{
if (lastImage != null && lastImage.Width > 0)
{
ratio = (double)pictureBox1.Width / lastImage.Width;
ratio = (double)pBoxOrig.Width / lastImage.Width;
}
}
catch
@@ -373,8 +372,8 @@ namespace ThermalImageStreamerDemo
try
{
var pTransf = new PerspectiveTransform(origPoints.Coords, destPoints.Coords);
var transfImg = pTransf.convertImage((Bitmap)pictureBox1.Image, dimX, dimY);
pictureBox2.Image = transfImg;
var transfImg = pTransf.convertImage((Bitmap)pBoxOrig.Image, dimX, dimY);
pBoxTraBn.Image = transfImg;
}
catch
{ }
@@ -382,11 +381,17 @@ namespace ThermalImageStreamerDemo
private void txtAB_TextChanged(object sender, EventArgs e)
{
// ricalcolo in proporzione altro valore...
dimY = (int)((double)dimX * 256 / 320);
// aggiorno punti dest
updateDestPt();
}
private void txtBC_TextChanged(object sender, EventArgs e)
{
// ricalcolo in proporzione altro valore...
dimX = (int)((double)dimY * 320 / 256);
// aggiorno punti dest
updateDestPt();
}
@@ -412,23 +417,5 @@ namespace ThermalImageStreamerDemo
chkReadTemp.Checked = false;
}
private void chkZoom_CheckedChanged(object sender, EventArgs e)
{
setPictureScale();
}
private void setPictureScale()
{
// se cliccato raddopppio sennò scalo 1:1...
int w = chkZoom.Checked ? 640 : 320;
int h = chkZoom.Checked ? 512 : 256;
Size pboxSize = new Size() { Width = w, Height = h };
Size panelSize = new Size() { Width = w + 4, Height = h + 4 };
pictureBox1.Size = pboxSize;
pictureBox2.Size = pboxSize;
// sistemo main form
Size windowSize = new Size() { Width = 238 + 2 * w, Height = 92 + 2 * h };
this.Size = windowSize;
}
}
}