Commit 002a27c7 by Neo Turing

增加裁剪功能

parent ca552351
......@@ -34,8 +34,10 @@
this.plControl = new System.Windows.Forms.Panel();
this.btnSave = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.plImage = new System.Windows.Forms.Panel();
this.imgResizer = new Kivii.Sample.ImageUploader.Controls.ImageResizer();
this.plControl.SuspendLayout();
this.plImage.SuspendLayout();
this.SuspendLayout();
//
// timeImageEditor
......@@ -48,9 +50,10 @@
this.plControl.Controls.Add(this.btnSave);
this.plControl.Controls.Add(this.btnCancel);
this.plControl.Dock = System.Windows.Forms.DockStyle.Bottom;
this.plControl.Location = new System.Drawing.Point(0, 715);
this.plControl.Location = new System.Drawing.Point(0, 391);
this.plControl.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.plControl.Name = "plControl";
this.plControl.Size = new System.Drawing.Size(807, 146);
this.plControl.Size = new System.Drawing.Size(584, 100);
this.plControl.TabIndex = 0;
//
// btnSave
......@@ -61,9 +64,8 @@
this.btnSave.Font = new System.Drawing.Font("宋体", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
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.Margin = new System.Windows.Forms.Padding(4);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(450, 146);
this.btnSave.Size = new System.Drawing.Size(346, 100);
this.btnSave.TabIndex = 5;
this.btnSave.Text = "保存";
this.btnSave.UseVisualStyleBackColor = false;
......@@ -74,36 +76,49 @@
this.btnCancel.BackColor = System.Drawing.SystemColors.ButtonHighlight;
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.Location = new System.Drawing.Point(450, 0);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
this.btnCancel.Location = new System.Drawing.Point(346, 0);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(357, 146);
this.btnCancel.Size = new System.Drawing.Size(238, 100);
this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = false;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// plImage
//
this.plImage.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.plImage.Controls.Add(this.imgResizer);
this.plImage.Dock = System.Windows.Forms.DockStyle.Fill;
this.plImage.Location = new System.Drawing.Point(0, 0);
this.plImage.Name = "plImage";
this.plImage.Size = new System.Drawing.Size(584, 391);
this.plImage.TabIndex = 2;
//
// imgResizer
//
this.imgResizer.BackColor = System.Drawing.Color.Transparent;
this.imgResizer.Location = new System.Drawing.Point(61, 37);
this.imgResizer.Location = new System.Drawing.Point(79, 40);
this.imgResizer.Margin = new System.Windows.Forms.Padding(2);
this.imgResizer.Name = "imgResizer";
this.imgResizer.Size = new System.Drawing.Size(681, 626);
this.imgResizer.Size = new System.Drawing.Size(430, 307);
this.imgResizer.TabIndex = 1;
this.imgResizer.Text = "imgResizer";
//
// FrmImageEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(807, 861);
this.Controls.Add(this.imgResizer);
this.ClientSize = new System.Drawing.Size(584, 491);
this.Controls.Add(this.plImage);
this.Controls.Add(this.plControl);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.MinimumSize = new System.Drawing.Size(600, 530);
this.Name = "FrmImageEditor";
this.Text = "图片裁剪";
this.Load += new System.EventHandler(this.FrmImageEditor_Load);
this.plControl.ResumeLayout(false);
this.plImage.ResumeLayout(false);
this.ResumeLayout(false);
}
......@@ -115,5 +130,6 @@
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnCancel;
private Controls.ImageResizer imgResizer;
private System.Windows.Forms.Panel plImage;
}
}
\ No newline at end of file
......@@ -49,7 +49,8 @@ namespace Kivii.Sample.ImageUploader
private void FrmImageEditor_Load(object sender, EventArgs e)
{
this.BackgroundImage = backgroundImage;
this.plImage.BackgroundImage = backgroundImage;
this.plImage.BackgroundImageLayout = ImageLayout.Center;
ImgEdited = backgroundImage;
}
private void btnCancel_Click(object sender, EventArgs e)
......@@ -59,10 +60,10 @@ namespace Kivii.Sample.ImageUploader
private void btnSave_Click(object sender, EventArgs e)
{
System.Drawing.Point p = new System.Drawing.Point(imgResizer.Location.X + imgResizer.blank, imgResizer.Location.Y + imgResizer.blank);
Rectangle area = new Rectangle(p, imgResizer.area.Size);
var imgArea = imgResizer.area;
Rectangle area = new Rectangle(p, imgArea.Size);
ImgEdited = GetPartOfImage(backgroundImage, area.Width, area.Height, p.X, p.Y);
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Bitmap bmpFluffy = ImgEdited;
//new Bitmap(after);
......@@ -72,44 +73,16 @@ namespace Kivii.Sample.ImageUploader
using (Graphics g = Graphics.FromImage(bmpMask))
using (GraphicsPath path = createRoundRect(
using (GraphicsPath path = createRoundRect(r.X, r.Y, r.Width, r.Height,0))
r.X, r.Y,
r.Width, r.Height,
0))
using (Brush brush = createFluffyBrush(
path,
new float[] { 0.0f, 0.1f, 1.0f },
new float[] { 0.0f, 0.95f, 1.0f }))
using (Brush brush = createFluffyBrush(path,new float[] { 0.0f, 0.1f, 1.0f },new float[] { 0.0f, 0.95f, 1.0f }))
{
g.FillRectangle(Brushes.Black, r);
g.SmoothingMode = SmoothingMode.HighQuality;
g.FillPath(brush, path);
transferOneARGBChannelFromOneBitmapToAnother(
bmpMask,
bmpFluffy,
ChannelARGB.Blue,
ChannelARGB.Alpha);
transferOneARGBChannelFromOneBitmapToAnother(bmpMask,bmpFluffy,ChannelARGB.Blue,ChannelARGB.Alpha);
}
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Graphics drawBk = Graphics.FromImage(backgroundImage);
drawBk.Clear(Color.FromKnownColor(KnownColor.Control));
drawBk.DrawImage(ImgEdited, area);
......@@ -117,11 +90,11 @@ namespace Kivii.Sample.ImageUploader
Graphics winGph = Graphics.FromHwnd(this.Handle);
winGph.DrawImage(backgroundImage, new System.Drawing.Point(0, 0));
this.BackgroundImage = backgroundImage;
this.plImage.BackgroundImage = backgroundImage;
imgResizer.Visible = false;
this.Refresh();
this.plImage.Refresh();
timeImageEditor.Enabled = true;
}
......
......@@ -86,9 +86,8 @@
this.plLeft.Controls.Add(this.gbCamView);
this.plLeft.Dock = System.Windows.Forms.DockStyle.Left;
this.plLeft.Location = new System.Drawing.Point(0, 0);
this.plLeft.Margin = new System.Windows.Forms.Padding(4);
this.plLeft.Name = "plLeft";
this.plLeft.Size = new System.Drawing.Size(430, 1022);
this.plLeft.Size = new System.Drawing.Size(287, 681);
this.plLeft.TabIndex = 0;
//
// gbSample
......@@ -96,11 +95,9 @@
this.gbSample.Controls.Add(this.rtbMessage);
this.gbSample.Controls.Add(this.plSearchReport);
this.gbSample.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbSample.Location = new System.Drawing.Point(0, 430);
this.gbSample.Margin = new System.Windows.Forms.Padding(4);
this.gbSample.Location = new System.Drawing.Point(0, 287);
this.gbSample.Name = "gbSample";
this.gbSample.Padding = new System.Windows.Forms.Padding(4);
this.gbSample.Size = new System.Drawing.Size(430, 274);
this.gbSample.Size = new System.Drawing.Size(287, 182);
this.gbSample.TabIndex = 3;
this.gbSample.TabStop = false;
this.gbSample.Text = "查询样品";
......@@ -109,9 +106,10 @@
//
this.rtbMessage.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtbMessage.Font = new System.Drawing.Font("宋体", 16F);
this.rtbMessage.Location = new System.Drawing.Point(4, 88);
this.rtbMessage.Location = new System.Drawing.Point(3, 59);
this.rtbMessage.Margin = new System.Windows.Forms.Padding(2);
this.rtbMessage.Name = "rtbMessage";
this.rtbMessage.Size = new System.Drawing.Size(422, 182);
this.rtbMessage.Size = new System.Drawing.Size(281, 120);
this.rtbMessage.TabIndex = 20;
this.rtbMessage.Text = "";
//
......@@ -120,10 +118,9 @@
this.plSearchReport.Controls.Add(this.tbxReportId);
this.plSearchReport.Controls.Add(this.btnReportId);
this.plSearchReport.Dock = System.Windows.Forms.DockStyle.Top;
this.plSearchReport.Location = new System.Drawing.Point(4, 25);
this.plSearchReport.Margin = new System.Windows.Forms.Padding(4);
this.plSearchReport.Location = new System.Drawing.Point(3, 17);
this.plSearchReport.Name = "plSearchReport";
this.plSearchReport.Size = new System.Drawing.Size(422, 63);
this.plSearchReport.Size = new System.Drawing.Size(281, 42);
this.plSearchReport.TabIndex = 19;
//
// tbxReportId
......@@ -131,10 +128,9 @@
this.tbxReportId.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbxReportId.Font = new System.Drawing.Font("宋体", 14F);
this.tbxReportId.Location = new System.Drawing.Point(0, 0);
this.tbxReportId.Margin = new System.Windows.Forms.Padding(4);
this.tbxReportId.Multiline = true;
this.tbxReportId.Name = "tbxReportId";
this.tbxReportId.Size = new System.Drawing.Size(311, 63);
this.tbxReportId.Size = new System.Drawing.Size(207, 42);
this.tbxReportId.TabIndex = 7;
this.tbxReportId.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbxReportId_KeyPress);
//
......@@ -143,10 +139,9 @@
this.btnReportId.BackColor = System.Drawing.SystemColors.ButtonHighlight;
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.Location = new System.Drawing.Point(311, 0);
this.btnReportId.Margin = new System.Windows.Forms.Padding(4);
this.btnReportId.Location = new System.Drawing.Point(207, 0);
this.btnReportId.Name = "btnReportId";
this.btnReportId.Size = new System.Drawing.Size(111, 63);
this.btnReportId.Size = new System.Drawing.Size(74, 42);
this.btnReportId.TabIndex = 8;
this.btnReportId.Text = "查询";
this.btnReportId.UseVisualStyleBackColor = false;
......@@ -163,11 +158,9 @@
this.gbLogin.Controls.Add(this.tbxServiceUrl);
this.gbLogin.Controls.Add(this.lblUrl);
this.gbLogin.Dock = System.Windows.Forms.DockStyle.Bottom;
this.gbLogin.Location = new System.Drawing.Point(0, 704);
this.gbLogin.Margin = new System.Windows.Forms.Padding(4);
this.gbLogin.Location = new System.Drawing.Point(0, 469);
this.gbLogin.Name = "gbLogin";
this.gbLogin.Padding = new System.Windows.Forms.Padding(4);
this.gbLogin.Size = new System.Drawing.Size(430, 318);
this.gbLogin.Size = new System.Drawing.Size(287, 212);
this.gbLogin.TabIndex = 2;
this.gbLogin.TabStop = false;
this.gbLogin.Text = "系统登录";
......@@ -177,10 +170,9 @@
this.btnLogout.BackColor = System.Drawing.Color.LavenderBlush;
this.btnLogout.Font = new System.Drawing.Font("宋体", 15F);
this.btnLogout.ForeColor = System.Drawing.Color.Crimson;
this.btnLogout.Location = new System.Drawing.Point(285, 249);
this.btnLogout.Margin = new System.Windows.Forms.Padding(4);
this.btnLogout.Location = new System.Drawing.Point(190, 166);
this.btnLogout.Name = "btnLogout";
this.btnLogout.Size = new System.Drawing.Size(136, 60);
this.btnLogout.Size = new System.Drawing.Size(91, 40);
this.btnLogout.TabIndex = 31;
this.btnLogout.Text = "退 出";
this.btnLogout.UseVisualStyleBackColor = false;
......@@ -191,10 +183,9 @@
this.btnLogin.BackColor = System.Drawing.Color.MintCream;
this.btnLogin.Font = new System.Drawing.Font("宋体", 15F);
this.btnLogin.ForeColor = System.Drawing.Color.DarkGreen;
this.btnLogin.Location = new System.Drawing.Point(8, 249);
this.btnLogin.Margin = new System.Windows.Forms.Padding(4);
this.btnLogin.Location = new System.Drawing.Point(5, 166);
this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(268, 60);
this.btnLogin.Size = new System.Drawing.Size(179, 40);
this.btnLogin.TabIndex = 30;
this.btnLogin.Text = "登 录";
this.btnLogin.UseVisualStyleBackColor = false;
......@@ -203,11 +194,10 @@
// tbxPassword
//
this.tbxPassword.Font = new System.Drawing.Font("宋体", 12F);
this.tbxPassword.Location = new System.Drawing.Point(4, 198);
this.tbxPassword.Margin = new System.Windows.Forms.Padding(4);
this.tbxPassword.Location = new System.Drawing.Point(3, 132);
this.tbxPassword.Name = "tbxPassword";
this.tbxPassword.PasswordChar = '*';
this.tbxPassword.Size = new System.Drawing.Size(415, 35);
this.tbxPassword.Size = new System.Drawing.Size(278, 26);
this.tbxPassword.TabIndex = 29;
this.tbxPassword.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbxPassword_KeyPress);
//
......@@ -215,30 +205,27 @@
//
this.lblPassword.AutoSize = true;
this.lblPassword.Font = new System.Drawing.Font("宋体", 12F);
this.lblPassword.Location = new System.Drawing.Point(3, 170);
this.lblPassword.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblPassword.Location = new System.Drawing.Point(2, 113);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(94, 24);
this.lblPassword.Size = new System.Drawing.Size(63, 16);
this.lblPassword.TabIndex = 28;
this.lblPassword.Text = "密 码:";
//
// tbxUserName
//
this.tbxUserName.Font = new System.Drawing.Font("宋体", 12F);
this.tbxUserName.Location = new System.Drawing.Point(4, 126);
this.tbxUserName.Margin = new System.Windows.Forms.Padding(4);
this.tbxUserName.Location = new System.Drawing.Point(3, 84);
this.tbxUserName.Name = "tbxUserName";
this.tbxUserName.Size = new System.Drawing.Size(415, 35);
this.tbxUserName.Size = new System.Drawing.Size(278, 26);
this.tbxUserName.TabIndex = 27;
//
// lblUser
//
this.lblUser.AutoSize = true;
this.lblUser.Font = new System.Drawing.Font("宋体", 12F);
this.lblUser.Location = new System.Drawing.Point(3, 98);
this.lblUser.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblUser.Location = new System.Drawing.Point(2, 65);
this.lblUser.Name = "lblUser";
this.lblUser.Size = new System.Drawing.Size(94, 24);
this.lblUser.Size = new System.Drawing.Size(63, 16);
this.lblUser.TabIndex = 26;
this.lblUser.Text = "用户名:";
//
......@@ -246,20 +233,18 @@
//
this.tbxServiceUrl.BackColor = System.Drawing.SystemColors.Window;
this.tbxServiceUrl.Font = new System.Drawing.Font("宋体", 12F);
this.tbxServiceUrl.Location = new System.Drawing.Point(4, 54);
this.tbxServiceUrl.Margin = new System.Windows.Forms.Padding(4);
this.tbxServiceUrl.Location = new System.Drawing.Point(3, 36);
this.tbxServiceUrl.Name = "tbxServiceUrl";
this.tbxServiceUrl.Size = new System.Drawing.Size(415, 35);
this.tbxServiceUrl.Size = new System.Drawing.Size(278, 26);
this.tbxServiceUrl.TabIndex = 25;
//
// lblUrl
//
this.lblUrl.AutoSize = true;
this.lblUrl.Font = new System.Drawing.Font("宋体", 12F);
this.lblUrl.Location = new System.Drawing.Point(3, 26);
this.lblUrl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblUrl.Location = new System.Drawing.Point(2, 17);
this.lblUrl.Name = "lblUrl";
this.lblUrl.Size = new System.Drawing.Size(94, 24);
this.lblUrl.Size = new System.Drawing.Size(63, 16);
this.lblUrl.TabIndex = 22;
this.lblUrl.Text = "地 址:";
//
......@@ -271,10 +256,8 @@
this.gbCamView.Dock = System.Windows.Forms.DockStyle.Top;
this.gbCamView.Font = new System.Drawing.Font("宋体", 10F);
this.gbCamView.Location = new System.Drawing.Point(0, 0);
this.gbCamView.Margin = new System.Windows.Forms.Padding(4);
this.gbCamView.Name = "gbCamView";
this.gbCamView.Padding = new System.Windows.Forms.Padding(4);
this.gbCamView.Size = new System.Drawing.Size(430, 430);
this.gbCamView.Size = new System.Drawing.Size(287, 287);
this.gbCamView.TabIndex = 0;
this.gbCamView.TabStop = false;
this.gbCamView.Text = "相机视图";
......@@ -283,10 +266,9 @@
//
this.btnSwitch.BackColor = System.Drawing.SystemColors.ButtonHighlight;
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(302, 369);
this.btnSwitch.Margin = new System.Windows.Forms.Padding(4);
this.btnSwitch.Location = new System.Drawing.Point(201, 246);
this.btnSwitch.Name = "btnSwitch";
this.btnSwitch.Size = new System.Drawing.Size(124, 52);
this.btnSwitch.Size = new System.Drawing.Size(83, 35);
this.btnSwitch.TabIndex = 4;
this.btnSwitch.Text = "切换相机";
this.btnSwitch.UseVisualStyleBackColor = false;
......@@ -296,10 +278,9 @@
//
this.cbxResolution.Font = new System.Drawing.Font("宋体", 20F);
this.cbxResolution.FormattingEnabled = true;
this.cbxResolution.Location = new System.Drawing.Point(4, 369);
this.cbxResolution.Margin = new System.Windows.Forms.Padding(4);
this.cbxResolution.Location = new System.Drawing.Point(3, 246);
this.cbxResolution.Name = "cbxResolution";
this.cbxResolution.Size = new System.Drawing.Size(288, 48);
this.cbxResolution.Size = new System.Drawing.Size(193, 35);
this.cbxResolution.TabIndex = 1;
this.cbxResolution.SelectedIndexChanged += new System.EventHandler(this.cbxResolution_SelectedIndexChanged);
//
......@@ -307,19 +288,17 @@
//
this.plVsp.Controls.Add(this.vspCamView);
this.plVsp.Dock = System.Windows.Forms.DockStyle.Top;
this.plVsp.Location = new System.Drawing.Point(4, 27);
this.plVsp.Margin = new System.Windows.Forms.Padding(4);
this.plVsp.Location = new System.Drawing.Point(3, 19);
this.plVsp.Name = "plVsp";
this.plVsp.Size = new System.Drawing.Size(422, 334);
this.plVsp.Size = new System.Drawing.Size(281, 223);
this.plVsp.TabIndex = 0;
//
// vspCamView
//
this.vspCamView.Dock = System.Windows.Forms.DockStyle.Fill;
this.vspCamView.Location = new System.Drawing.Point(0, 0);
this.vspCamView.Margin = new System.Windows.Forms.Padding(4);
this.vspCamView.Name = "vspCamView";
this.vspCamView.Size = new System.Drawing.Size(422, 334);
this.vspCamView.Size = new System.Drawing.Size(281, 223);
this.vspCamView.TabIndex = 0;
this.vspCamView.Text = "vspCamView";
this.vspCamView.VideoSource = null;
......@@ -329,10 +308,9 @@
this.plRight.Controls.Add(this.gbPhotoList);
this.plRight.Controls.Add(this.gbUploading);
this.plRight.Dock = System.Windows.Forms.DockStyle.Right;
this.plRight.Location = new System.Drawing.Point(1066, 0);
this.plRight.Margin = new System.Windows.Forms.Padding(4);
this.plRight.Location = new System.Drawing.Point(711, 0);
this.plRight.Name = "plRight";
this.plRight.Size = new System.Drawing.Size(350, 1022);
this.plRight.Size = new System.Drawing.Size(233, 681);
this.plRight.TabIndex = 1;
//
// gbPhotoList
......@@ -341,10 +319,8 @@
this.gbPhotoList.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPhotoList.Font = new System.Drawing.Font("宋体", 10F);
this.gbPhotoList.Location = new System.Drawing.Point(0, 0);
this.gbPhotoList.Margin = new System.Windows.Forms.Padding(4);
this.gbPhotoList.Name = "gbPhotoList";
this.gbPhotoList.Padding = new System.Windows.Forms.Padding(4);
this.gbPhotoList.Size = new System.Drawing.Size(350, 874);
this.gbPhotoList.Size = new System.Drawing.Size(233, 582);
this.gbPhotoList.TabIndex = 2;
this.gbPhotoList.TabStop = false;
this.gbPhotoList.Text = "已拍照片";
......@@ -355,21 +331,19 @@
this.flpPhotos.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.flpPhotos.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.flpPhotos.Dock = System.Windows.Forms.DockStyle.Fill;
this.flpPhotos.Location = new System.Drawing.Point(4, 27);
this.flpPhotos.Location = new System.Drawing.Point(3, 19);
this.flpPhotos.Margin = new System.Windows.Forms.Padding(0);
this.flpPhotos.Name = "flpPhotos";
this.flpPhotos.Size = new System.Drawing.Size(342, 843);
this.flpPhotos.Size = new System.Drawing.Size(227, 560);
this.flpPhotos.TabIndex = 2;
//
// gbUploading
//
this.gbUploading.Controls.Add(this.btnUpload);
this.gbUploading.Dock = System.Windows.Forms.DockStyle.Bottom;
this.gbUploading.Location = new System.Drawing.Point(0, 874);
this.gbUploading.Margin = new System.Windows.Forms.Padding(4);
this.gbUploading.Location = new System.Drawing.Point(0, 582);
this.gbUploading.Name = "gbUploading";
this.gbUploading.Padding = new System.Windows.Forms.Padding(4);
this.gbUploading.Size = new System.Drawing.Size(350, 148);
this.gbUploading.Size = new System.Drawing.Size(233, 99);
this.gbUploading.TabIndex = 1;
this.gbUploading.TabStop = false;
this.gbUploading.Text = "操作台";
......@@ -379,10 +353,9 @@
this.btnUpload.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.btnUpload.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnUpload.Font = new System.Drawing.Font("宋体", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnUpload.Location = new System.Drawing.Point(4, 25);
this.btnUpload.Margin = new System.Windows.Forms.Padding(4);
this.btnUpload.Location = new System.Drawing.Point(3, 17);
this.btnUpload.Name = "btnUpload";
this.btnUpload.Size = new System.Drawing.Size(342, 119);
this.btnUpload.Size = new System.Drawing.Size(227, 79);
this.btnUpload.TabIndex = 3;
this.btnUpload.Text = "上传";
this.btnUpload.UseVisualStyleBackColor = false;
......@@ -393,10 +366,9 @@
this.plMain.Controls.Add(this.gbPhotoView);
this.plMain.Controls.Add(this.gbOperating);
this.plMain.Dock = System.Windows.Forms.DockStyle.Fill;
this.plMain.Location = new System.Drawing.Point(430, 0);
this.plMain.Margin = new System.Windows.Forms.Padding(4);
this.plMain.Location = new System.Drawing.Point(287, 0);
this.plMain.Name = "plMain";
this.plMain.Size = new System.Drawing.Size(636, 1022);
this.plMain.Size = new System.Drawing.Size(424, 681);
this.plMain.TabIndex = 2;
//
// gbPhotoView
......@@ -406,10 +378,8 @@
this.gbPhotoView.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbPhotoView.Font = new System.Drawing.Font("宋体", 10F);
this.gbPhotoView.Location = new System.Drawing.Point(0, 0);
this.gbPhotoView.Margin = new System.Windows.Forms.Padding(4);
this.gbPhotoView.Name = "gbPhotoView";
this.gbPhotoView.Padding = new System.Windows.Forms.Padding(4);
this.gbPhotoView.Size = new System.Drawing.Size(636, 874);
this.gbPhotoView.Size = new System.Drawing.Size(424, 582);
this.gbPhotoView.TabIndex = 1;
this.gbPhotoView.TabStop = false;
this.gbPhotoView.Text = "选中照片";
......@@ -418,10 +388,9 @@
//
this.ptbPhotoDisplay.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.ptbPhotoDisplay.Dock = System.Windows.Forms.DockStyle.Fill;
this.ptbPhotoDisplay.Location = new System.Drawing.Point(4, 27);
this.ptbPhotoDisplay.Margin = new System.Windows.Forms.Padding(4);
this.ptbPhotoDisplay.Location = new System.Drawing.Point(3, 19);
this.ptbPhotoDisplay.Name = "ptbPhotoDisplay";
this.ptbPhotoDisplay.Size = new System.Drawing.Size(628, 804);
this.ptbPhotoDisplay.Size = new System.Drawing.Size(418, 534);
this.ptbPhotoDisplay.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.ptbPhotoDisplay.TabIndex = 4;
this.ptbPhotoDisplay.TabStop = false;
......@@ -430,10 +399,9 @@
//
this.plDisplay.Controls.Add(this.lbDisplay);
this.plDisplay.Dock = System.Windows.Forms.DockStyle.Bottom;
this.plDisplay.Location = new System.Drawing.Point(4, 831);
this.plDisplay.Margin = new System.Windows.Forms.Padding(4);
this.plDisplay.Location = new System.Drawing.Point(3, 553);
this.plDisplay.Name = "plDisplay";
this.plDisplay.Size = new System.Drawing.Size(628, 39);
this.plDisplay.Size = new System.Drawing.Size(418, 26);
this.plDisplay.TabIndex = 3;
//
// lbDisplay
......@@ -441,9 +409,8 @@
this.lbDisplay.AutoSize = true;
this.lbDisplay.Dock = System.Windows.Forms.DockStyle.Fill;
this.lbDisplay.Location = new System.Drawing.Point(0, 0);
this.lbDisplay.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lbDisplay.Name = "lbDisplay";
this.lbDisplay.Size = new System.Drawing.Size(89, 20);
this.lbDisplay.Size = new System.Drawing.Size(63, 14);
this.lbDisplay.TabIndex = 0;
this.lbDisplay.Text = "照片名称";
//
......@@ -453,11 +420,9 @@
this.gbOperating.Controls.Add(this.btnEditor);
this.gbOperating.Controls.Add(this.btnDelete);
this.gbOperating.Dock = System.Windows.Forms.DockStyle.Bottom;
this.gbOperating.Location = new System.Drawing.Point(0, 874);
this.gbOperating.Margin = new System.Windows.Forms.Padding(4);
this.gbOperating.Location = new System.Drawing.Point(0, 582);
this.gbOperating.Name = "gbOperating";
this.gbOperating.Padding = new System.Windows.Forms.Padding(4);
this.gbOperating.Size = new System.Drawing.Size(636, 148);
this.gbOperating.Size = new System.Drawing.Size(424, 99);
this.gbOperating.TabIndex = 0;
this.gbOperating.TabStop = false;
this.gbOperating.Text = "操作台";
......@@ -469,10 +434,9 @@
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.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(128)))), ((int)(((byte)(128)))), ((int)(((byte)(255)))));
this.btnShot.Location = new System.Drawing.Point(4, 25);
this.btnShot.Margin = new System.Windows.Forms.Padding(4);
this.btnShot.Location = new System.Drawing.Point(3, 17);
this.btnShot.Name = "btnShot";
this.btnShot.Size = new System.Drawing.Size(278, 119);
this.btnShot.Size = new System.Drawing.Size(185, 79);
this.btnShot.TabIndex = 5;
this.btnShot.Text = "拍照";
this.btnShot.UseVisualStyleBackColor = false;
......@@ -483,10 +447,9 @@
this.btnEditor.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.btnEditor.Dock = System.Windows.Forms.DockStyle.Right;
this.btnEditor.Font = new System.Drawing.Font("宋体", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnEditor.Location = new System.Drawing.Point(282, 25);
this.btnEditor.Margin = new System.Windows.Forms.Padding(4);
this.btnEditor.Location = new System.Drawing.Point(188, 17);
this.btnEditor.Name = "btnEditor";
this.btnEditor.Size = new System.Drawing.Size(206, 119);
this.btnEditor.Size = new System.Drawing.Size(137, 79);
this.btnEditor.TabIndex = 4;
this.btnEditor.Text = "裁剪";
this.btnEditor.UseVisualStyleBackColor = false;
......@@ -497,10 +460,9 @@
this.btnDelete.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.btnDelete.Dock = System.Windows.Forms.DockStyle.Right;
this.btnDelete.Font = new System.Drawing.Font("宋体", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnDelete.Location = new System.Drawing.Point(488, 25);
this.btnDelete.Margin = new System.Windows.Forms.Padding(4);
this.btnDelete.Location = new System.Drawing.Point(325, 17);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(144, 119);
this.btnDelete.Size = new System.Drawing.Size(96, 79);
this.btnDelete.TabIndex = 2;
this.btnDelete.Text = "删除";
this.btnDelete.UseVisualStyleBackColor = false;
......@@ -508,14 +470,13 @@
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(1416, 1022);
this.ClientSize = new System.Drawing.Size(944, 681);
this.Controls.Add(this.plMain);
this.Controls.Add(this.plRight);
this.Controls.Add(this.plLeft);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(4);
this.Name = "FrmMain";
this.Text = "样品拍照采集";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmMain_FormClosing);
......
......@@ -872,26 +872,32 @@ namespace Kivii.Sample.ImageUploader
MessageBox.Show("当前照片已上传,无法编辑");
return;
}
FrmImageEditor imageEditor = new FrmImageEditor();
FrmImageEditor frm = new FrmImageEditor();
Bitmap bmp = currentPhoto.Image;
imageEditor.backgroundImage = bmp;
frm.backgroundImage = bmp;
if (bmp.Width > 1280)
imageEditor.Width = 1280;
else
imageEditor.Width = bmp.Width;
if (bmp.Height > 1024)
imageEditor.Height = 1024;
else
imageEditor.Height = bmp.Height + 20;
imageEditor.Owner = this;
frm.Width= bmp.Width;
frm.Height = bmp.Height + 120;
frm.Owner = this;
imageEditor.ShowDialog();
frm.ShowDialog();
}
public void setBackgroundImage(Bitmap backgroundImage)
{
this.BackgroundImage = backgroundImage;
//currentPhoto.Image = backgroundImage;
int index = 0;
var photo = photos.FirstOrDefault(o => o.Image == currentPhoto.Image);
if (photo != null)
{
index = photos.IndexOf(photo);
if (index <= -1) index = 0;
deleteSnapshot(photo);
}
var editedPhoto = new DbFile(backgroundImage, currentPhoto.Name);
addSnapshot(editedPhoto, index);
showSnapshot(editedPhoto);
}
}
}
......@@ -7,7 +7,7 @@
<ProjectGuid>{9C9A89CF-F17F-4607-A89E-5E07C184EB1E}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Kivii.Sample.ImageUploader</RootNamespace>
<AssemblyName>Kivii.Sample.ImageUploader</AssemblyName>
<AssemblyName>样品拍照采集</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
......
......@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
//通过使用 "*",如下所示:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("5.4.2024.5280")]
[assembly: AssemblyFileVersion("5.4.2024.5280")]
[assembly: AssemblyVersion("5.4.2024.5300")]
[assembly: AssemblyFileVersion("5.4.2024.5300")]
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