StandardCamera.TestStartEndForm : Image rotation, ver. 2.17.749
This commit is contained in:
parent
8772004e8e
commit
ad858266d5
@ -20,6 +20,15 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
Deferred,
|
||||
}
|
||||
|
||||
enum Rotation
|
||||
{
|
||||
R0,
|
||||
R90,
|
||||
R180,
|
||||
R270,
|
||||
Count
|
||||
}
|
||||
|
||||
public partial class TestStartEndForm : Form, GenericDevices.IHasCompleted
|
||||
{
|
||||
private static readonly ILog log = LogManager.GetLogger(typeof(TestStartEndForm));
|
||||
@ -51,7 +60,8 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
|
||||
string lastImageName;
|
||||
Bitmap lastImage; /// non-zoomed image
|
||||
Bitmap zoomedImage;
|
||||
static Rotation imageRotation;
|
||||
Bitmap zoomedImage;
|
||||
bool zoom;
|
||||
|
||||
|
||||
@ -677,7 +687,24 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
/// Load the image in a way is does not lock the file on the disk
|
||||
using (var tempBmp = new Bitmap(lastImageName))
|
||||
{
|
||||
pictureBox1.Image = lastImage = new Bitmap(tempBmp);
|
||||
switch (imageRotation)
|
||||
{
|
||||
case Rotation.R0:
|
||||
pictureBox1.Image = lastImage = new Bitmap(tempBmp.Clone(new Rectangle(160, 0, 960, 960), tempBmp.PixelFormat));
|
||||
break;
|
||||
case Rotation.R90:
|
||||
tempBmp.RotateFlip(RotateFlipType.Rotate270FlipNone);
|
||||
pictureBox1.Image = lastImage = new Bitmap(tempBmp.Clone(new Rectangle(0, 160, 960, 960), tempBmp.PixelFormat));
|
||||
break;
|
||||
case Rotation.R180:
|
||||
tempBmp.RotateFlip(RotateFlipType.Rotate180FlipNone);
|
||||
pictureBox1.Image = lastImage = new Bitmap(tempBmp.Clone(new Rectangle(160, 0, 960, 960), tempBmp.PixelFormat));
|
||||
break;
|
||||
case Rotation.R270:
|
||||
tempBmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
||||
pictureBox1.Image = lastImage = new Bitmap(tempBmp.Clone(new Rectangle(0, 160, 960, 960), tempBmp.PixelFormat));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
zoom = false;
|
||||
@ -794,5 +821,34 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
return string.Format("{0} l", 1 / pulsesPerLtr);
|
||||
}
|
||||
}
|
||||
|
||||
private void rotateImageButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (++imageRotation == Rotation.Count) imageRotation = Rotation.R0;
|
||||
/// Load the image in a way is does not lock the file on the disk
|
||||
|
||||
/// Load the image in a way is does not lock the file on the disk
|
||||
using (var tempBmp = new Bitmap(lastImageName))
|
||||
{
|
||||
switch (imageRotation)
|
||||
{
|
||||
case Rotation.R0:
|
||||
pictureBox1.Image = lastImage = new Bitmap(tempBmp.Clone(new Rectangle(160, 0, 960, 960), tempBmp.PixelFormat));
|
||||
break;
|
||||
case Rotation.R90:
|
||||
tempBmp.RotateFlip(RotateFlipType.Rotate270FlipNone);
|
||||
pictureBox1.Image = lastImage = new Bitmap(tempBmp.Clone(new Rectangle(0, 160, 960, 960), tempBmp.PixelFormat));
|
||||
break;
|
||||
case Rotation.R180:
|
||||
tempBmp.RotateFlip(RotateFlipType.Rotate180FlipNone);
|
||||
pictureBox1.Image = lastImage = new Bitmap(tempBmp.Clone(new Rectangle(160, 0, 960, 960), tempBmp.PixelFormat));
|
||||
break;
|
||||
case Rotation.R270:
|
||||
tempBmp.RotateFlip(RotateFlipType.Rotate90FlipNone);
|
||||
pictureBox1.Image = lastImage = new Bitmap(tempBmp.Clone(new Rectangle(0, 160, 960, 960), tempBmp.PixelFormat));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -133,6 +133,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
this.endTextBox13 = new System.Windows.Forms.TextBox();
|
||||
this.label13 = new System.Windows.Forms.Label();
|
||||
this.pictureBox1 = new System.Windows.Forms.PictureBox();
|
||||
this.rotateImageButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
@ -191,7 +192,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
//
|
||||
this.okButton.Font = new System.Drawing.Font("Verdana", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.okButton.ForeColor = System.Drawing.Color.Black;
|
||||
this.okButton.Location = new System.Drawing.Point(976, 42);
|
||||
this.okButton.Location = new System.Drawing.Point(937, 54);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(98, 63);
|
||||
this.okButton.TabIndex = 100;
|
||||
@ -1414,20 +1415,32 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
//
|
||||
// pictureBox1
|
||||
//
|
||||
this.pictureBox1.Location = new System.Drawing.Point(261, 5);
|
||||
this.pictureBox1.Location = new System.Drawing.Point(335, 5);
|
||||
this.pictureBox1.Name = "pictureBox1";
|
||||
this.pictureBox1.Size = new System.Drawing.Size(640, 480);
|
||||
this.pictureBox1.Size = new System.Drawing.Size(480, 480);
|
||||
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
|
||||
this.pictureBox1.TabIndex = 101;
|
||||
this.pictureBox1.TabStop = false;
|
||||
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
|
||||
//
|
||||
// rotateImageButton
|
||||
//
|
||||
this.rotateImageButton.Font = new System.Drawing.Font("Arial", 27.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
|
||||
this.rotateImageButton.Location = new System.Drawing.Point(826, 435);
|
||||
this.rotateImageButton.Name = "rotateImageButton";
|
||||
this.rotateImageButton.Size = new System.Drawing.Size(50, 50);
|
||||
this.rotateImageButton.TabIndex = 102;
|
||||
this.rotateImageButton.Text = "↺";
|
||||
this.rotateImageButton.UseVisualStyleBackColor = true;
|
||||
this.rotateImageButton.Click += new System.EventHandler(this.rotateImageButton_Click);
|
||||
//
|
||||
// TestStartEndForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.DarkGoldenrod;
|
||||
this.ClientSize = new System.Drawing.Size(1146, 885);
|
||||
this.Controls.Add(this.rotateImageButton);
|
||||
this.Controls.Add(this.pictureBox1);
|
||||
this.Controls.Add(this.exclamation24);
|
||||
this.Controls.Add(this.startTextBox24);
|
||||
@ -1646,6 +1659,7 @@ namespace TBF.BenchControl.DataEntry.StandardCamera
|
||||
private System.Windows.Forms.TextBox endTextBox13;
|
||||
private System.Windows.Forms.Label label13;
|
||||
private System.Windows.Forms.PictureBox pictureBox1;
|
||||
private System.Windows.Forms.Button rotateImageButton;
|
||||
|
||||
}
|
||||
}
|
||||
@ -29,5 +29,5 @@ using System.Runtime.InteropServices;
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
[assembly: AssemblyVersion("2.17.748.0")]
|
||||
[assembly: AssemblyFileVersion("2.17.748.0")]
|
||||
[assembly: AssemblyVersion("2.17.749.0")]
|
||||
[assembly: AssemblyFileVersion("2.17.749.0")]
|
||||
|
||||
@ -1060,7 +1060,7 @@
|
||||
<value>Ref.durchfluss [m3/h]:</value>
|
||||
</data>
|
||||
<data name="Ref_freq_Hz_" xml:space="preserve">
|
||||
<value>Ref.Frekvenz [Hz]:</value>
|
||||
<value>Ref.Frequenz [Hz]:</value>
|
||||
</data>
|
||||
<data name="Ref_pulses_" xml:space="preserve">
|
||||
<value>Ref.Impulse:</value>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user