Commit 2bbb2012 by Neo Turing

优化

parent 5ec7e266
...@@ -50,10 +50,10 @@ ...@@ -50,10 +50,10 @@
this.plControl.Controls.Add(this.btnSave); this.plControl.Controls.Add(this.btnSave);
this.plControl.Controls.Add(this.btnCancel); this.plControl.Controls.Add(this.btnCancel);
this.plControl.Dock = System.Windows.Forms.DockStyle.Bottom; this.plControl.Dock = System.Windows.Forms.DockStyle.Bottom;
this.plControl.Location = new System.Drawing.Point(0, 391); this.plControl.Location = new System.Drawing.Point(0, 514);
this.plControl.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.plControl.Margin = new System.Windows.Forms.Padding(2);
this.plControl.Name = "plControl"; this.plControl.Name = "plControl";
this.plControl.Size = new System.Drawing.Size(584, 100); this.plControl.Size = new System.Drawing.Size(748, 100);
this.plControl.TabIndex = 0; this.plControl.TabIndex = 0;
// //
// btnSave // btnSave
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
this.btnSave.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); this.btnSave.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
this.btnSave.Location = new System.Drawing.Point(0, 0); this.btnSave.Location = new System.Drawing.Point(0, 0);
this.btnSave.Name = "btnSave"; this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(346, 100); this.btnSave.Size = new System.Drawing.Size(510, 100);
this.btnSave.TabIndex = 5; this.btnSave.TabIndex = 5;
this.btnSave.Text = "保存"; this.btnSave.Text = "保存";
this.btnSave.UseVisualStyleBackColor = false; this.btnSave.UseVisualStyleBackColor = false;
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
this.btnCancel.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.btnCancel.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.btnCancel.Dock = System.Windows.Forms.DockStyle.Right; this.btnCancel.Dock = System.Windows.Forms.DockStyle.Right;
this.btnCancel.Font = new System.Drawing.Font("宋体", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnCancel.Font = new System.Drawing.Font("宋体", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCancel.Location = new System.Drawing.Point(346, 0); this.btnCancel.Location = new System.Drawing.Point(510, 0);
this.btnCancel.Name = "btnCancel"; this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(238, 100); this.btnCancel.Size = new System.Drawing.Size(238, 100);
this.btnCancel.TabIndex = 4; this.btnCancel.TabIndex = 4;
...@@ -91,16 +91,16 @@ ...@@ -91,16 +91,16 @@
this.plImage.Dock = System.Windows.Forms.DockStyle.Fill; this.plImage.Dock = System.Windows.Forms.DockStyle.Fill;
this.plImage.Location = new System.Drawing.Point(0, 0); this.plImage.Location = new System.Drawing.Point(0, 0);
this.plImage.Name = "plImage"; this.plImage.Name = "plImage";
this.plImage.Size = new System.Drawing.Size(584, 391); this.plImage.Size = new System.Drawing.Size(748, 514);
this.plImage.TabIndex = 2; this.plImage.TabIndex = 2;
// //
// imgResizer // imgResizer
// //
this.imgResizer.BackColor = System.Drawing.Color.Transparent; this.imgResizer.BackColor = System.Drawing.Color.Transparent;
this.imgResizer.Location = new System.Drawing.Point(79, 40); this.imgResizer.Location = new System.Drawing.Point(151, 11);
this.imgResizer.Margin = new System.Windows.Forms.Padding(2); this.imgResizer.Margin = new System.Windows.Forms.Padding(2);
this.imgResizer.Name = "imgResizer"; this.imgResizer.Name = "imgResizer";
this.imgResizer.Size = new System.Drawing.Size(430, 307); this.imgResizer.Size = new System.Drawing.Size(430, 498);
this.imgResizer.TabIndex = 1; this.imgResizer.TabIndex = 1;
this.imgResizer.Text = "imgResizer"; this.imgResizer.Text = "imgResizer";
// //
...@@ -108,15 +108,16 @@ ...@@ -108,15 +108,16 @@
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 491); this.ClientSize = new System.Drawing.Size(748, 614);
this.Controls.Add(this.plImage); this.Controls.Add(this.plImage);
this.Controls.Add(this.plControl); this.Controls.Add(this.plControl);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); this.Margin = new System.Windows.Forms.Padding(2);
this.MinimumSize = new System.Drawing.Size(600, 530); this.MinimumSize = new System.Drawing.Size(600, 530);
this.Name = "FrmImageEditor"; this.Name = "FrmImageEditor";
this.Text = "图片裁剪"; this.Text = "图片裁剪";
this.Load += new System.EventHandler(this.FrmImageEditor_Load); this.Load += new System.EventHandler(this.FrmImageEditor_Load);
this.Resize += new System.EventHandler(this.FrmImageEditor_Resize);
this.plControl.ResumeLayout(false); this.plControl.ResumeLayout(false);
this.plImage.ResumeLayout(false); this.plImage.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
......
using Kivii.Zip.Zlib; using Kivii.Controls;
using Kivii.Zip.Zlib;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
...@@ -15,6 +16,7 @@ namespace Kivii.Sample.ImageUploader ...@@ -15,6 +16,7 @@ namespace Kivii.Sample.ImageUploader
{ {
public partial class FrmImageEditor : Form public partial class FrmImageEditor : Form
{ {
private float _zoom = 1f;
public FrmImageEditor() public FrmImageEditor()
{ {
InitializeComponent(); InitializeComponent();
...@@ -50,8 +52,9 @@ namespace Kivii.Sample.ImageUploader ...@@ -50,8 +52,9 @@ namespace Kivii.Sample.ImageUploader
private void FrmImageEditor_Load(object sender, EventArgs e) private void FrmImageEditor_Load(object sender, EventArgs e)
{ {
this.plImage.BackgroundImage = backgroundImage; this.plImage.BackgroundImage = backgroundImage;
this.plImage.BackgroundImageLayout = ImageLayout.Center; this.plImage.BackgroundImageLayout = ImageLayout.Zoom;
ImgEdited = backgroundImage; ImgEdited = backgroundImage;
resizePictureBox();
} }
private void btnCancel_Click(object sender, EventArgs e) private void btnCancel_Click(object sender, EventArgs e)
{ {
...@@ -98,6 +101,43 @@ namespace Kivii.Sample.ImageUploader ...@@ -98,6 +101,43 @@ namespace Kivii.Sample.ImageUploader
timeImageEditor.Enabled = true; timeImageEditor.Enabled = true;
} }
#region 窗口大小发生变化
protected override void OnResize(EventArgs e)
{
base.OnResize(e);
resizePictureBox();
}
private void resizePictureBox()
{
if (plImage.BackgroundImage == null) return;
int width, height;
if (_zoom == 0f)
{
float wzoom = (float)plImage.Width / (float)plImage.BackgroundImage.Width;
float hzoom = (float)plImage.Height / (float)plImage.BackgroundImage.Height;
_zoom = wzoom < hzoom ? wzoom : hzoom;
}
else if (_zoom > 5f) _zoom = 5f;
else if (_zoom < 0.1f) _zoom = 0.1f;
width = (int)((float)plImage.BackgroundImage.Width * _zoom);
height = (int)((float)plImage.BackgroundImage.Height * _zoom);
plImage.Width = width;
plImage.Height = height;
int x, y;
if (plImage.Width <= width) x = 0;
else x = (plImage.Width - width) / 2;
if (plImage.Height <= height) y = 0;
else y = (plImage.Height - height) / 2;
plImage.Location = new System.Drawing.Point(x, y);
// 计算控件在父容器中居中的位置
int xi = (imgResizer.Parent.Width - imgResizer.Width) / 2;
int yi = (imgResizer.Parent.Height - imgResizer.Height) / 2;
imgResizer.Location= new System.Drawing.Point(xi, yi);
}
#endregion
public static GraphicsPath createRoundRect(int x, int y, int width, int height, int radius) public static GraphicsPath createRoundRect(int x, int y, int width, int height, int radius)
{ {
...@@ -208,6 +248,9 @@ namespace Kivii.Sample.ImageUploader ...@@ -208,6 +248,9 @@ namespace Kivii.Sample.ImageUploader
} }
private void FrmImageEditor_Resize(object sender, EventArgs e)
{
resizePictureBox();
}
} }
} }
...@@ -45,8 +45,10 @@ ...@@ -45,8 +45,10 @@
this.tbxServiceUrl = new System.Windows.Forms.TextBox(); this.tbxServiceUrl = new System.Windows.Forms.TextBox();
this.lblUrl = new System.Windows.Forms.Label(); this.lblUrl = new System.Windows.Forms.Label();
this.gbCamView = new System.Windows.Forms.GroupBox(); this.gbCamView = new System.Windows.Forms.GroupBox();
this.cbxResolution = new System.Windows.Forms.ComboBox();
this.btnSwitch = new System.Windows.Forms.Button(); this.btnSwitch = new System.Windows.Forms.Button();
this.plVsp = new System.Windows.Forms.Panel(); this.plVsp = new System.Windows.Forms.Panel();
this.vspCamView = new Kivii.Sample.ImageUploader.Controls.VideoSourcePlayer();
this.plRight = new System.Windows.Forms.Panel(); this.plRight = new System.Windows.Forms.Panel();
this.gbPhotoList = new System.Windows.Forms.GroupBox(); this.gbPhotoList = new System.Windows.Forms.GroupBox();
this.flpPhotos = new System.Windows.Forms.FlowLayoutPanel(); this.flpPhotos = new System.Windows.Forms.FlowLayoutPanel();
...@@ -56,14 +58,12 @@ ...@@ -56,14 +58,12 @@
this.gbPhotoView = new System.Windows.Forms.GroupBox(); this.gbPhotoView = new System.Windows.Forms.GroupBox();
this.ptbPhotoDisplay = new System.Windows.Forms.PictureBox(); this.ptbPhotoDisplay = new System.Windows.Forms.PictureBox();
this.plDisplay = new System.Windows.Forms.Panel(); this.plDisplay = new System.Windows.Forms.Panel();
this.btnCamearTurn = new System.Windows.Forms.Button();
this.lbDisplay = new System.Windows.Forms.Label(); this.lbDisplay = new System.Windows.Forms.Label();
this.gbOperating = new System.Windows.Forms.GroupBox(); this.gbOperating = new System.Windows.Forms.GroupBox();
this.btnShot = new System.Windows.Forms.Button(); this.btnShot = new System.Windows.Forms.Button();
this.btnEditor = new System.Windows.Forms.Button(); this.btnEditor = new System.Windows.Forms.Button();
this.btnDelete = new System.Windows.Forms.Button(); this.btnDelete = new System.Windows.Forms.Button();
this.btnCamearTurn = new System.Windows.Forms.Button();
this.vspCamView = new Kivii.Sample.ImageUploader.Controls.VideoSourcePlayer();
this.cbxResolution = new System.Windows.Forms.ComboBox();
this.plLeft.SuspendLayout(); this.plLeft.SuspendLayout();
this.gbSample.SuspendLayout(); this.gbSample.SuspendLayout();
this.plSearchReport.SuspendLayout(); this.plSearchReport.SuspendLayout();
...@@ -107,10 +107,10 @@ ...@@ -107,10 +107,10 @@
// //
this.rtbMessage.Dock = System.Windows.Forms.DockStyle.Fill; this.rtbMessage.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtbMessage.Font = new System.Drawing.Font("宋体", 14F); this.rtbMessage.Font = new System.Drawing.Font("宋体", 14F);
this.rtbMessage.Location = new System.Drawing.Point(3, 59); this.rtbMessage.Location = new System.Drawing.Point(3, 54);
this.rtbMessage.Margin = new System.Windows.Forms.Padding(2); this.rtbMessage.Margin = new System.Windows.Forms.Padding(2);
this.rtbMessage.Name = "rtbMessage"; this.rtbMessage.Name = "rtbMessage";
this.rtbMessage.Size = new System.Drawing.Size(246, 137); this.rtbMessage.Size = new System.Drawing.Size(246, 142);
this.rtbMessage.TabIndex = 20; this.rtbMessage.TabIndex = 20;
this.rtbMessage.Text = ""; this.rtbMessage.Text = "";
// //
...@@ -121,17 +121,17 @@ ...@@ -121,17 +121,17 @@
this.plSearchReport.Dock = System.Windows.Forms.DockStyle.Top; this.plSearchReport.Dock = System.Windows.Forms.DockStyle.Top;
this.plSearchReport.Location = new System.Drawing.Point(3, 17); this.plSearchReport.Location = new System.Drawing.Point(3, 17);
this.plSearchReport.Name = "plSearchReport"; this.plSearchReport.Name = "plSearchReport";
this.plSearchReport.Size = new System.Drawing.Size(246, 42); this.plSearchReport.Size = new System.Drawing.Size(246, 37);
this.plSearchReport.TabIndex = 19; this.plSearchReport.TabIndex = 19;
// //
// tbxReportId // tbxReportId
// //
this.tbxReportId.Dock = System.Windows.Forms.DockStyle.Fill; this.tbxReportId.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbxReportId.Font = new System.Drawing.Font("宋体", 14F); this.tbxReportId.Font = new System.Drawing.Font("宋体", 12F);
this.tbxReportId.Location = new System.Drawing.Point(0, 0); this.tbxReportId.Location = new System.Drawing.Point(0, 0);
this.tbxReportId.Multiline = true; this.tbxReportId.Multiline = true;
this.tbxReportId.Name = "tbxReportId"; this.tbxReportId.Name = "tbxReportId";
this.tbxReportId.Size = new System.Drawing.Size(172, 42); this.tbxReportId.Size = new System.Drawing.Size(187, 37);
this.tbxReportId.TabIndex = 7; this.tbxReportId.TabIndex = 7;
this.tbxReportId.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbxReportId_KeyPress); this.tbxReportId.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbxReportId_KeyPress);
// //
...@@ -140,9 +140,9 @@ ...@@ -140,9 +140,9 @@
this.btnReportId.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.btnReportId.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.btnReportId.Dock = System.Windows.Forms.DockStyle.Right; this.btnReportId.Dock = System.Windows.Forms.DockStyle.Right;
this.btnReportId.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnReportId.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnReportId.Location = new System.Drawing.Point(172, 0); this.btnReportId.Location = new System.Drawing.Point(187, 0);
this.btnReportId.Name = "btnReportId"; this.btnReportId.Name = "btnReportId";
this.btnReportId.Size = new System.Drawing.Size(74, 42); this.btnReportId.Size = new System.Drawing.Size(59, 37);
this.btnReportId.TabIndex = 8; this.btnReportId.TabIndex = 8;
this.btnReportId.Text = "查询"; this.btnReportId.Text = "查询";
this.btnReportId.UseVisualStyleBackColor = false; this.btnReportId.UseVisualStyleBackColor = false;
...@@ -263,16 +263,27 @@ ...@@ -263,16 +263,27 @@
this.gbCamView.TabStop = false; this.gbCamView.TabStop = false;
this.gbCamView.Text = "相机视图"; this.gbCamView.Text = "相机视图";
// //
// cbxResolution
//
this.cbxResolution.Dock = System.Windows.Forms.DockStyle.Fill;
this.cbxResolution.Font = new System.Drawing.Font("宋体", 18F);
this.cbxResolution.FormattingEnabled = true;
this.cbxResolution.Location = new System.Drawing.Point(3, 285);
this.cbxResolution.Name = "cbxResolution";
this.cbxResolution.Size = new System.Drawing.Size(187, 32);
this.cbxResolution.TabIndex = 5;
this.cbxResolution.SelectedIndexChanged += new System.EventHandler(this.cbxResolution_SelectedIndexChanged);
//
// btnSwitch // btnSwitch
// //
this.btnSwitch.BackColor = System.Drawing.SystemColors.ButtonHighlight; this.btnSwitch.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.btnSwitch.Dock = System.Windows.Forms.DockStyle.Right; this.btnSwitch.Dock = System.Windows.Forms.DockStyle.Right;
this.btnSwitch.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnSwitch.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnSwitch.Location = new System.Drawing.Point(167, 273); this.btnSwitch.Location = new System.Drawing.Point(190, 285);
this.btnSwitch.Name = "btnSwitch"; this.btnSwitch.Name = "btnSwitch";
this.btnSwitch.Size = new System.Drawing.Size(82, 44); this.btnSwitch.Size = new System.Drawing.Size(59, 32);
this.btnSwitch.TabIndex = 4; this.btnSwitch.TabIndex = 4;
this.btnSwitch.Text = "切换相机"; this.btnSwitch.Text = "切换";
this.btnSwitch.UseVisualStyleBackColor = false; this.btnSwitch.UseVisualStyleBackColor = false;
this.btnSwitch.Click += new System.EventHandler(this.btnSwitch_Click); this.btnSwitch.Click += new System.EventHandler(this.btnSwitch_Click);
// //
...@@ -282,9 +293,19 @@ ...@@ -282,9 +293,19 @@
this.plVsp.Dock = System.Windows.Forms.DockStyle.Top; this.plVsp.Dock = System.Windows.Forms.DockStyle.Top;
this.plVsp.Location = new System.Drawing.Point(3, 19); this.plVsp.Location = new System.Drawing.Point(3, 19);
this.plVsp.Name = "plVsp"; this.plVsp.Name = "plVsp";
this.plVsp.Size = new System.Drawing.Size(246, 254); this.plVsp.Size = new System.Drawing.Size(246, 266);
this.plVsp.TabIndex = 0; this.plVsp.TabIndex = 0;
// //
// vspCamView
//
this.vspCamView.Dock = System.Windows.Forms.DockStyle.Fill;
this.vspCamView.Location = new System.Drawing.Point(0, 0);
this.vspCamView.Name = "vspCamView";
this.vspCamView.Size = new System.Drawing.Size(246, 266);
this.vspCamView.TabIndex = 0;
this.vspCamView.Text = "vspCamView";
this.vspCamView.VideoSource = null;
//
// plRight // plRight
// //
this.plRight.Controls.Add(this.gbPhotoList); this.plRight.Controls.Add(this.gbPhotoList);
...@@ -341,6 +362,7 @@ ...@@ -341,6 +362,7 @@
this.btnUpload.TabIndex = 3; this.btnUpload.TabIndex = 3;
this.btnUpload.Text = "上传"; this.btnUpload.Text = "上传";
this.btnUpload.UseVisualStyleBackColor = false; this.btnUpload.UseVisualStyleBackColor = false;
this.btnUpload.EnabledChanged += new System.EventHandler(this.btnEnabled_EnabledChanged);
this.btnUpload.Click += new System.EventHandler(this.btnUpload_Click); this.btnUpload.Click += new System.EventHandler(this.btnUpload_Click);
// //
// plMain // plMain
...@@ -387,6 +409,18 @@ ...@@ -387,6 +409,18 @@
this.plDisplay.Size = new System.Drawing.Size(535, 28); this.plDisplay.Size = new System.Drawing.Size(535, 28);
this.plDisplay.TabIndex = 3; this.plDisplay.TabIndex = 3;
// //
// btnCamearTurn
//
this.btnCamearTurn.Dock = System.Windows.Forms.DockStyle.Right;
this.btnCamearTurn.Location = new System.Drawing.Point(447, 0);
this.btnCamearTurn.Name = "btnCamearTurn";
this.btnCamearTurn.Size = new System.Drawing.Size(88, 28);
this.btnCamearTurn.TabIndex = 31;
this.btnCamearTurn.Text = "旋转";
this.btnCamearTurn.UseVisualStyleBackColor = true;
this.btnCamearTurn.EnabledChanged += new System.EventHandler(this.btnEnabled_EnabledChanged);
this.btnCamearTurn.Click += new System.EventHandler(this.btnCamearTurn_Click);
//
// lbDisplay // lbDisplay
// //
this.lbDisplay.AutoSize = true; this.lbDisplay.AutoSize = true;
...@@ -412,17 +446,17 @@ ...@@ -412,17 +446,17 @@
// //
// btnShot // btnShot
// //
this.btnShot.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); this.btnShot.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.btnShot.Dock = System.Windows.Forms.DockStyle.Fill; this.btnShot.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnShot.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.btnShot.Font = new System.Drawing.Font("宋体", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.btnShot.Font = new System.Drawing.Font("宋体", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnShot.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255))))); this.btnShot.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnShot.Location = new System.Drawing.Point(3, 17); this.btnShot.Location = new System.Drawing.Point(3, 17);
this.btnShot.Name = "btnShot"; this.btnShot.Name = "btnShot";
this.btnShot.Size = new System.Drawing.Size(343, 59); this.btnShot.Size = new System.Drawing.Size(343, 59);
this.btnShot.TabIndex = 5; this.btnShot.TabIndex = 5;
this.btnShot.Text = "拍照"; this.btnShot.Text = "拍照";
this.btnShot.UseVisualStyleBackColor = false; this.btnShot.UseVisualStyleBackColor = false;
this.btnShot.EnabledChanged += new System.EventHandler(this.btnEnabled_EnabledChanged);
this.btnShot.Click += new System.EventHandler(this.btnShot_Click); this.btnShot.Click += new System.EventHandler(this.btnShot_Click);
// //
// btnEditor // btnEditor
...@@ -436,6 +470,7 @@ ...@@ -436,6 +470,7 @@
this.btnEditor.TabIndex = 4; this.btnEditor.TabIndex = 4;
this.btnEditor.Text = "裁剪"; this.btnEditor.Text = "裁剪";
this.btnEditor.UseVisualStyleBackColor = false; this.btnEditor.UseVisualStyleBackColor = false;
this.btnEditor.EnabledChanged += new System.EventHandler(this.btnEnabled_EnabledChanged);
this.btnEditor.Click += new System.EventHandler(this.btnEditor_Click); this.btnEditor.Click += new System.EventHandler(this.btnEditor_Click);
// //
// btnDelete // btnDelete
...@@ -449,40 +484,9 @@ ...@@ -449,40 +484,9 @@
this.btnDelete.TabIndex = 2; this.btnDelete.TabIndex = 2;
this.btnDelete.Text = "删除"; this.btnDelete.Text = "删除";
this.btnDelete.UseVisualStyleBackColor = false; this.btnDelete.UseVisualStyleBackColor = false;
this.btnDelete.EnabledChanged += new System.EventHandler(this.btnEnabled_EnabledChanged);
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click); this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
// //
// btnCamearTurn
//
this.btnCamearTurn.Dock = System.Windows.Forms.DockStyle.Right;
this.btnCamearTurn.Location = new System.Drawing.Point(447, 0);
this.btnCamearTurn.Name = "btnCamearTurn";
this.btnCamearTurn.Size = new System.Drawing.Size(88, 28);
this.btnCamearTurn.TabIndex = 31;
this.btnCamearTurn.Text = "旋转";
this.btnCamearTurn.UseVisualStyleBackColor = true;
this.btnCamearTurn.Click += new System.EventHandler(this.btnCamearTurn_Click);
//
// vspCamView
//
this.vspCamView.Dock = System.Windows.Forms.DockStyle.Fill;
this.vspCamView.Location = new System.Drawing.Point(0, 0);
this.vspCamView.Name = "vspCamView";
this.vspCamView.Size = new System.Drawing.Size(246, 254);
this.vspCamView.TabIndex = 0;
this.vspCamView.Text = "vspCamView";
this.vspCamView.VideoSource = null;
//
// cbxResolution
//
this.cbxResolution.Dock = System.Windows.Forms.DockStyle.Fill;
this.cbxResolution.Font = new System.Drawing.Font("宋体", 20F);
this.cbxResolution.FormattingEnabled = true;
this.cbxResolution.Location = new System.Drawing.Point(3, 273);
this.cbxResolution.Name = "cbxResolution";
this.cbxResolution.Size = new System.Drawing.Size(164, 35);
this.cbxResolution.TabIndex = 5;
this.cbxResolution.SelectedIndexChanged += new System.EventHandler(this.cbxResolution_SelectedIndexChanged);
//
// FrmMain // FrmMain
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
......
...@@ -122,6 +122,7 @@ namespace Kivii.Sample.ImageUploader ...@@ -122,6 +122,7 @@ namespace Kivii.Sample.ImageUploader
btnDelete.Enabled = !notLogin; btnDelete.Enabled = !notLogin;
btnEditor.Enabled = !notLogin; btnEditor.Enabled = !notLogin;
btnLogout.Enabled = !notLogin; btnLogout.Enabled = !notLogin;
btnCamearTurn.Enabled = !notLogin;
if (notLogin) if (notLogin)
{ {
...@@ -140,6 +141,8 @@ namespace Kivii.Sample.ImageUploader ...@@ -140,6 +141,8 @@ namespace Kivii.Sample.ImageUploader
//lbCurrentSampleQuantity.Text = "__________"; //lbCurrentSampleQuantity.Text = "__________";
ptbPhotoDisplay.Image = null; ptbPhotoDisplay.Image = null;
flpPhotos.Controls.Clear(); flpPhotos.Controls.Clear();
currentReport = null;
currentPhoto = null;
} }
else else
{ {
...@@ -167,7 +170,9 @@ namespace Kivii.Sample.ImageUploader ...@@ -167,7 +170,9 @@ namespace Kivii.Sample.ImageUploader
foreach (var prop in properties) foreach (var prop in properties)
{ {
if (prop.GetDescription().IsNullOrEmpty()) continue; if (prop.GetDescription().IsNullOrEmpty()) continue;
var msg = $"{prop.GetDescription()}:{prop.GetValue(currentReport)}"; var value = prop.GetValue(currentReport);
if (value == null) continue;
var msg = $"{prop.GetDescription()}:{value}";
outputMessage(msg); outputMessage(msg);
} }
...@@ -493,9 +498,13 @@ namespace Kivii.Sample.ImageUploader ...@@ -493,9 +498,13 @@ namespace Kivii.Sample.ImageUploader
{ {
if (resp.Results.IsNullOrEmpty()) if (resp.Results.IsNullOrEmpty())
{ {
MessageBox.Show($"未找到此编号:{reportId}"); //MessageBox.Show($"未找到此编号:{reportId}");
tbxReportId.Text = ""; tbxReportId.Text = "";
currentReport = null;
currentReport = new Report();
currentReport.ReportId = reportId;
currentReport.SampleName = "无样品报告模式";
currentReport.SampleModel = "此模式下上传的图片可在公共图片库中查看";
} }
else else
{ {
...@@ -924,8 +933,9 @@ namespace Kivii.Sample.ImageUploader ...@@ -924,8 +933,9 @@ namespace Kivii.Sample.ImageUploader
Bitmap bmp = currentPhoto.Image; Bitmap bmp = currentPhoto.Image;
frm.backgroundImage = bmp; frm.backgroundImage = bmp;
frm.Width= bmp.Width; frm.WindowState = FormWindowState.Maximized;
frm.Height = bmp.Height + 120; //frm.Width= bmp.Width;
//frm.Height = bmp.Height + 120;
frm.Owner = this; frm.Owner = this;
frm.ShowDialog(); frm.ShowDialog();
...@@ -947,5 +957,20 @@ namespace Kivii.Sample.ImageUploader ...@@ -947,5 +957,20 @@ namespace Kivii.Sample.ImageUploader
addSnapshot(editedPhoto, index); addSnapshot(editedPhoto, index);
showSnapshot(editedPhoto); showSnapshot(editedPhoto);
} }
private void btnEnabled_EnabledChanged(object sender, EventArgs e)
{
if(btnShot.Enabled) btnShot.BackColor = Color.White;
else btnShot.BackColor = SystemColors.ButtonFace;
if(btnEditor.Enabled) btnEditor.BackColor = Color.White;
else btnEditor.BackColor = SystemColors.ButtonFace;
if(btnDelete.Enabled) btnDelete.BackColor = Color.White;
else btnDelete.BackColor = SystemColors.ButtonFace;
if (btnUpload.Enabled) btnUpload.BackColor = Color.White;
else btnUpload.BackColor = SystemColors.ButtonFace;
if (btnCamearTurn.Enabled) btnCamearTurn.BackColor = Color.White;
else btnCamearTurn.BackColor = SystemColors.ButtonFace;
}
} }
} }
...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices; ...@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示: //通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2024.5300")] [assembly: AssemblyVersion("5.4.2024.6040")]
[assembly: AssemblyFileVersion("5.4.2024.5300")] [assembly: AssemblyFileVersion("5.4.2024.6040")]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment