Commit 8e27b1a4 by 陶然

优化裁剪功能

parent 8fadbd7d
using System.Drawing;
using System.Windows.Forms;
namespace Kivii.Sample.ImageUploader.Controls
{
public class ImageResizer : Control
{
public string fileName;
public ImageResizer()
{
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
//this.BackColor = Color.Empty;
this.BackColor = Color.Transparent;
//this.BackColor = Color.FromArgb(50, Color.Red);
//以下是设置双缓冲的代码 要不然在下面onPaint里的绘制半透明背景会让你很伤心,或者上面那句设置半透明背景用了过后拖动时也会让你跟蜗牛一样。
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景.
this.SetStyle(ControlStyles.DoubleBuffer, true);
}
public Size border;
private System.Drawing.Point m_MousePoint;
private Size m_Size;
private System.Drawing.Point m_LastPoint;
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
this.m_LastPoint = this.Location;
this.m_MousePoint = this.PointToScreen(e.Location);
this.m_Size = this.Size;
//this.BackColor = Color.Empty;
}
protected override void OnMouseMove(MouseEventArgs e)
{
base.OnMouseMove(e);
if (arow != arrowType.none)
{
ReResize(e);
return;
}
if (e.Y <= recArrow[4].Bottom && e.Y >= recArrow[4].Top && e.X >= recArrow[4].Left && e.X <= recArrow[4].Right)//左上
Cursor = Cursors.SizeNWSE;
else if (e.Y <= recArrow[5].Bottom && e.Y >= recArrow[5].Top && e.X >= recArrow[5].Left && e.X <= recArrow[5].Right)//左下
Cursor = Cursors.SizeNESW;
else if (e.Y <= recArrow[6].Bottom && e.Y >= recArrow[6].Top && e.X >= recArrow[6].Left && e.X <= recArrow[6].Right)//右上
Cursor = Cursors.SizeNESW;
else if (e.Y <= recArrow[7].Bottom && e.Y >= recArrow[7].Top && e.X >= recArrow[7].Left && e.X <= recArrow[7].Right)//右下
Cursor = Cursors.SizeNWSE;
else if (e.Y <= recArrow[0].Bottom && e.Y >= recArrow[0].Top)//上
Cursor = Cursors.SizeNS;
else if (e.Y <= recArrow[1].Bottom && e.Y >= recArrow[1].Top)//下
Cursor = Cursors.SizeNS;
else if (e.X >= recArrow[2].Left && e.X <= recArrow[2].Right)//左
Cursor = Cursors.SizeWE;
else if (e.X >= recArrow[3].Left && e.X <= recArrow[3].Right)//右
Cursor = Cursors.SizeWE;
else
Cursor = Cursors.SizeAll;
if (e.Button == MouseButtons.Left)
{
System.Drawing.Point t = this.PointToScreen(e.Location);
System.Drawing.Point l = this.m_LastPoint;
if (e.Y <= recArrow[4].Bottom && e.Y >= recArrow[4].Top && e.X >= recArrow[4].Left && e.X <= recArrow[4].Right)//左上
arow = arrowType.leftUp;
else if (e.Y <= recArrow[5].Bottom && e.Y >= recArrow[5].Top && e.X >= recArrow[5].Left && e.X <= recArrow[5].Right)//左下
arow = arrowType.leftDown;
else if (e.Y <= recArrow[6].Bottom && e.Y >= recArrow[6].Top && e.X >= recArrow[6].Left && e.X <= recArrow[6].Right)//右上
arow = arrowType.rightUp;
else if (e.Y <= recArrow[7].Bottom && e.Y >= recArrow[7].Top && e.X >= recArrow[7].Left && e.X <= recArrow[7].Right)//右下
arow = arrowType.rightDown;
else if (e.Y <= recArrow[0].Bottom && e.Y >= recArrow[0].Top)//上
arow = arrowType.up;
else if (e.Y <= recArrow[1].Bottom && e.Y >= recArrow[1].Top)//下
arow = arrowType.down;
else if (e.X >= recArrow[2].Left && e.X <= recArrow[2].Right)//左
arow = arrowType.left;
else if (e.X >= recArrow[3].Left && e.X <= recArrow[3].Right)//右
arow = arrowType.right;
else
arow = arrowType.none;
l.Offset(t.X - this.m_MousePoint.X, t.Y - this.m_MousePoint.Y);
if (arow != arrowType.none)
ReResize(e);
else
{
this.Location = l;
Refresh();//这句很重要立即重绘 不然拖动到时候会出现卡卡 的现象 ,找了半天原因
}
}
}
public void ReResize(MouseEventArgs e)
{
System.Drawing.Point t = this.PointToScreen(e.Location);
System.Drawing.Point l = this.m_LastPoint;
l.Offset(t.X - this.m_MousePoint.X, t.Y - this.m_MousePoint.Y);
switch (arow)
{
case arrowType.up:
{
this.Height = m_Size.Height - (t.Y - this.m_MousePoint.Y);
this.Location = new System.Drawing.Point(m_LastPoint.X, l.Y);
break;
}
case arrowType.down:
{
this.Height = m_Size.Height + (t.Y - this.m_MousePoint.Y);
break;
}
case arrowType.left:
{
this.Width = m_Size.Width - (t.X - this.m_MousePoint.X);
this.Location = new System.Drawing.Point(l.X, m_LastPoint.Y);
break;
}
case arrowType.right:
{
this.Width = m_Size.Width + (t.X - this.m_MousePoint.X);
break;
}
case arrowType.leftUp:
{
this.Width = m_Size.Width - (t.X - this.m_MousePoint.X);
this.Height = m_Size.Height - (t.Y - this.m_MousePoint.Y);
this.Location = new System.Drawing.Point(l.X, l.Y);
break;
}
case arrowType.leftDown:
{
this.Width = m_Size.Width - (t.X - this.m_MousePoint.X);
this.Height = m_Size.Height + (t.Y - this.m_MousePoint.Y);
this.Location = new System.Drawing.Point(l.X, m_LastPoint.Y);
break;
}
case arrowType.rightUp:
{
this.Width = m_Size.Width + (t.X - this.m_MousePoint.X);
this.Height = m_Size.Height - (t.Y - this.m_MousePoint.Y);
this.Location = new System.Drawing.Point(m_LastPoint.X, l.Y);
break;
}
case arrowType.rightDown:
{
this.Width = m_Size.Width + (t.X - this.m_MousePoint.X);
this.Height = m_Size.Height + (t.Y - this.m_MousePoint.Y);
break;
}
}
this.Refresh();
}
public enum arrowType
{
up, down, left, right, leftUp, leftDown, rightUp, rightDown, none
}
public arrowType arow = arrowType.none;
Rectangle[] recArrow = new Rectangle[8];//8个手柄
public Rectangle area;//选择区域
public readonly int blank = 8;//边距
protected override void OnPaint(PaintEventArgs e)
{
int side = 6;//手柄矩形的边长
recArrow[0] = new Rectangle(new System.Drawing.Point(this.Width / 2 - side / 2, blank - side / 2), new Size(side, side));
recArrow[1] = new Rectangle(new System.Drawing.Point(this.Width / 2 - side / 2, this.Height - blank - side / 2), new Size(side, side));
recArrow[2] = new Rectangle(new System.Drawing.Point(blank - side / 2, this.Height / 2 - side / 2), new Size(side, side));
recArrow[3] = new Rectangle(new System.Drawing.Point(this.Width - blank - side / 2, this.Height / 2 - side / 2), new Size(side, side));
recArrow[4] = new Rectangle(new System.Drawing.Point(blank - side / 2, blank - side / 2), new Size(side, side));
recArrow[5] = new Rectangle(new System.Drawing.Point(blank - side / 2, this.Height - blank - side / 2), new Size(side, side));
recArrow[6] = new Rectangle(new System.Drawing.Point(this.Width - blank - side / 2, blank - side / 2), new Size(side, side));
recArrow[7] = new Rectangle(new System.Drawing.Point(this.Width - blank - side / 2, this.Height - blank - side / 2), new Size(side, side));
foreach (Rectangle item in recArrow)
e.Graphics.DrawRectangle(Pens.Red, item);
area = new Rectangle(new System.Drawing.Point(8, 8), new Size(this.Width - 8 * 2, this.Height - 8 * 2));
////加上半透明效果看倒是好看了 重绘的时候卡的凶 ,期待有解决方法
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
System.Drawing.Color cor = System.Drawing.Color.FromArgb(50, Color.Red);
System.Drawing.SolidBrush bsh = new System.Drawing.SolidBrush(cor);
e.Graphics.FillRectangle(bsh, area);
e.Graphics.DrawRectangle(Pens.Red, area);
}
protected override void OnMouseUp(MouseEventArgs e)
{
arow = arrowType.none;
//this.BackColor = Color.FromArgb(0, Color.Red);
}
}
}
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Kivii.Sample.ImageUploader.Controls
{
internal class PanelEx : Panel
{
#region 属性
private Rectangle _selectionBounds = Rectangle.Empty;
/// <summary>
/// 选择区域的XY
/// </summary>
public Rectangle SelectionBounds
{
get
{
return _selectionBounds;
}
set
{
_selectionBounds = value;
}
}
/// <summary>
/// 启用选择区域
/// </summary>
public bool EnableSelection { get; set; }
private Color _selectionBorderColor = Color.Red;
/// <summary>
/// 选择区域边界颜色
/// </summary>
[DefaultValue(typeof(Color), "Red")]
public Color SelectionBorderColor
{
get { return _selectionBorderColor; }
set { _selectionBorderColor = value; this.Invalidate(); }
}
private int _selectionBorderWidth = 2;
/// <summary>
/// 选择区域边界线粗细
/// </summary>
[DefaultValue(2)]
public int SelectionBorderWidth
{
get { return _selectionBorderWidth; }
set { _selectionBorderWidth = value; this.Invalidate(); }
}
/// <summary>
/// 起始偏移量
/// </summary>
private System.Drawing.Point _startPosition = new System.Drawing.Point(0, 0);
/// <summary>
/// 是否正在移动
/// </summary>
private int _movingStatus = 0;
#endregion
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (EnableSelection)
{
using (Pen p = new Pen(this.SelectionBorderColor, this.SelectionBorderWidth))
{
e.Graphics.DrawRectangle(p, SelectionBounds);
}
}
}
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
if (e.Button == System.Windows.Forms.MouseButtons.Left)
{
if (SelectionBounds.Contains(e.X, e.Y))
{
_startPosition = new System.Drawing.Point(e.X, e.Y);
_movingStatus = 1;
}
}
}
protected override void OnMouseMove(MouseEventArgs e)
{
if (_movingStatus == 0)
{
base.OnMouseMove(e);
return;
}
Rectangle rect;
if (_movingStatus == 2)
{
rect = new Rectangle(this.PointToScreen(_selectionBounds.Location), _selectionBounds.Size);
ControlPaint.DrawReversibleFrame(rect, Color.SkyBlue, FrameStyle.Thick);
}
_movingStatus = 2;
_selectionBounds.Offset(e.X - _startPosition.X, e.Y - _startPosition.Y);
_startPosition.X = e.X;
_startPosition.Y = e.Y;
if (_selectionBounds.X < 0)
{
_selectionBounds.X = 0;
}
if (_selectionBounds.Y < 0)
{
_selectionBounds.Y = 0;
}
if (_selectionBounds.Right > this.ClientSize.Width)
{
_selectionBounds.X = this.ClientSize.Width - _selectionBounds.Width;
}
if (_selectionBounds.Bottom > this.ClientSize.Height)
{
_selectionBounds.Y = this.ClientSize.Height - _selectionBounds.Height;
}
rect = new Rectangle(this.PointToScreen(_selectionBounds.Location), _selectionBounds.Size);
ControlPaint.DrawReversibleFrame(rect, Color.SkyBlue, FrameStyle.Thick);
this.Cursor = Cursors.SizeAll;
base.OnMouseMove(e);
}
protected override void OnMouseUp(MouseEventArgs e)
{
if (_movingStatus == 2) this.Invalidate();
_movingStatus = 0;
base.OnMouseUp(e);
}
public Image GetSelectionImage(float zoom)
{
if (this.BackgroundImage == null) return null;
if (!EnableSelection) return this.BackgroundImage;
Bitmap bmp = new Bitmap(_selectionBounds.Width, _selectionBounds.Height);
using (Graphics g = Graphics.FromImage(bmp))
{
g.DrawImage(
this.BackgroundImage,
new Rectangle(0, 0, bmp.Width, bmp.Height), _selectionBounds.X / zoom, _selectionBounds.Y / zoom, _selectionBounds.Width / zoom, _selectionBounds.Height / zoom, GraphicsUnit.Pixel);
}
return bmp;
}
}
}
......@@ -34,10 +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.panel = new System.Windows.Forms.Panel();
this.pictureBox = new Kivii.Sample.ImageUploader.Controls.PanelEx();
this.plControl.SuspendLayout();
this.plImage.SuspendLayout();
this.panel.SuspendLayout();
this.SuspendLayout();
//
// timeImageEditor
......@@ -50,10 +50,9 @@
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, 514);
this.plControl.Margin = new System.Windows.Forms.Padding(2);
this.plControl.Location = new System.Drawing.Point(0, 771);
this.plControl.Name = "plControl";
this.plControl.Size = new System.Drawing.Size(748, 100);
this.plControl.Size = new System.Drawing.Size(1122, 150);
this.plControl.TabIndex = 0;
//
// btnSave
......@@ -64,8 +63,9 @@
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(510, 100);
this.btnSave.Size = new System.Drawing.Size(765, 150);
this.btnSave.TabIndex = 5;
this.btnSave.Text = "保存";
this.btnSave.UseVisualStyleBackColor = false;
......@@ -76,50 +76,53 @@
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(510, 0);
this.btnCancel.Location = new System.Drawing.Point(765, 0);
this.btnCancel.Margin = new System.Windows.Forms.Padding(4);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(238, 100);
this.btnCancel.Size = new System.Drawing.Size(357, 150);
this.btnCancel.TabIndex = 4;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = false;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// plImage
// panel
//
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(748, 514);
this.plImage.TabIndex = 2;
this.panel.AutoScroll = true;
this.panel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
this.panel.Controls.Add(this.pictureBox);
this.panel.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel.Location = new System.Drawing.Point(0, 0);
this.panel.Margin = new System.Windows.Forms.Padding(4);
this.panel.Name = "panel";
this.panel.Size = new System.Drawing.Size(1122, 771);
this.panel.TabIndex = 2;
//
// imgResizer
// pictureBox
//
this.imgResizer.BackColor = System.Drawing.Color.Transparent;
this.imgResizer.Location = new System.Drawing.Point(151, 11);
this.imgResizer.Margin = new System.Windows.Forms.Padding(2);
this.imgResizer.Name = "imgResizer";
this.imgResizer.Size = new System.Drawing.Size(430, 498);
this.imgResizer.TabIndex = 1;
this.imgResizer.Text = "imgResizer";
this.pictureBox.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBox.EnableSelection = false;
this.pictureBox.Location = new System.Drawing.Point(250, 253);
this.pictureBox.Name = "pictureBox";
this.pictureBox.SelectionBounds = new System.Drawing.Rectangle(0, 0, 0, 0);
this.pictureBox.Size = new System.Drawing.Size(38, 32);
this.pictureBox.TabIndex = 0;
//
// FrmImageEditor
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(748, 614);
this.Controls.Add(this.plImage);
this.ClientSize = new System.Drawing.Size(1122, 921);
this.Controls.Add(this.panel);
this.Controls.Add(this.plControl);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(2);
this.MinimumSize = new System.Drawing.Size(600, 530);
this.MinimumSize = new System.Drawing.Size(889, 767);
this.Name = "FrmImageEditor";
this.Text = "图片裁剪";
this.Load += new System.EventHandler(this.FrmImageEditor_Load);
this.Resize += new System.EventHandler(this.FrmImageEditor_Resize);
this.plControl.ResumeLayout(false);
this.plImage.ResumeLayout(false);
this.panel.ResumeLayout(false);
this.ResumeLayout(false);
}
......@@ -130,7 +133,7 @@
private System.Windows.Forms.Panel plControl;
private System.Windows.Forms.Button btnSave;
private System.Windows.Forms.Button btnCancel;
private Controls.ImageResizer imgResizer;
private System.Windows.Forms.Panel plImage;
private System.Windows.Forms.Panel panel;
private Controls.PanelEx pictureBox;
}
}
\ No newline at end of file
......@@ -20,28 +20,13 @@ namespace Kivii.Sample.ImageUploader
public FrmImageEditor()
{
InitializeComponent();
pictureBox.SelectionBounds = new Rectangle(0, 0, 500, 600);
}
public Bitmap backgroundImage;
public Bitmap ImgEdited;
//图像裁剪
public Bitmap GetPartOfImage(Bitmap sourceImg, int width, int height, int offsetX, int offsetY)
{
Bitmap sourceBitmap = sourceImg;
Bitmap rtns = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage(rtns))
{
Rectangle resultRectangle = new Rectangle(0, 0, width, height);
Rectangle sourceRectangle = new Rectangle(0 + offsetX, 0 + offsetY, width, height);
g.DrawImage(sourceBitmap, resultRectangle, sourceRectangle, GraphicsUnit.Pixel);
}
return rtns;
}
private void timeImageEditor_Tick(object sender, EventArgs e)
{
FrmMain main = (FrmMain)this.Owner;
......@@ -51,9 +36,9 @@ namespace Kivii.Sample.ImageUploader
private void FrmImageEditor_Load(object sender, EventArgs e)
{
this.plImage.BackgroundImage = backgroundImage;
this.plImage.BackgroundImageLayout = ImageLayout.Zoom;
ImgEdited = backgroundImage;
pictureBox.BackgroundImage = backgroundImage;
pictureBox.BackgroundImageLayout = ImageLayout.Zoom;
pictureBox.EnableSelection = true;
resizePictureBox();
}
private void btnCancel_Click(object sender, EventArgs e)
......@@ -62,44 +47,27 @@ 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);
var imgArea = imgResizer.area;
Rectangle area = new Rectangle(p, imgArea.Size);
ImgEdited = GetPartOfImage(backgroundImage, area.Width, area.Height, p.X, p.Y);
ImgEdited = new Bitmap(GetSelectionImage());
Bitmap bmpFluffy = ImgEdited;
//new Bitmap(after);
Rectangle r = new Rectangle(System.Drawing.Point.Empty, bmpFluffy.Size);
using (Bitmap bmpMask = new Bitmap(r.Width, r.Height))
using (Graphics g = Graphics.FromImage(bmpMask))
using (GraphicsPath path = createRoundRect(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 }))
pictureBox.Refresh();
timeImageEditor.Enabled = true;
}
private void FrmImageEditor_Resize(object sender, EventArgs e)
{
g.FillRectangle(Brushes.Black, r);
g.SmoothingMode = SmoothingMode.HighQuality;
g.FillPath(brush, path);
transferOneARGBChannelFromOneBitmapToAnother(bmpMask,bmpFluffy,ChannelARGB.Blue,ChannelARGB.Alpha);
resizePictureBox();
}
Graphics drawBk = Graphics.FromImage(backgroundImage);
drawBk.Clear(Color.FromKnownColor(KnownColor.Control));
drawBk.DrawImage(ImgEdited, area);
Graphics winGph = Graphics.FromHwnd(this.Handle);
winGph.DrawImage(backgroundImage, new System.Drawing.Point(0, 0));
this.plImage.BackgroundImage = backgroundImage;
imgResizer.Visible = false;
this.plImage.Refresh();
timeImageEditor.Enabled = true;
#region 返回图片
public Image GetSelectionImage()
{
return pictureBox.GetSelectionImage(_zoom);
}
public void SetSelectionImage(Image img)
{
pictureBox.BackgroundImage = img;
resizePictureBox();
}
#endregion
#region 窗口大小发生变化
protected override void OnResize(EventArgs e)
......@@ -109,148 +77,27 @@ namespace Kivii.Sample.ImageUploader
}
private void resizePictureBox()
{
if (plImage.BackgroundImage == null) return;
if (pictureBox.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;
float wzoom = (float)panel.Width / (float)pictureBox.BackgroundImage.Width;
float hzoom = (float)panel.Height / (float)pictureBox.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;
width = (int)((float)pictureBox.BackgroundImage.Width * _zoom);
height = (int)((float)pictureBox.BackgroundImage.Height * _zoom);
pictureBox.Width = width;
pictureBox.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);
if (panel.Width <= width) x = 0;
else x = (panel.Width - width) / 2;
if (panel.Height <= height) y = 0;
else y = (panel.Height - height) / 2;
pictureBox.Location = new System.Drawing.Point(x, y);
}
#endregion
public static GraphicsPath createRoundRect(int x, int y, int width, int height, int radius)
{
GraphicsPath gp = new GraphicsPath();
if (radius == 0)
gp.AddRectangle(new Rectangle(x, y, width, height));
else
{
gp.AddLine(x + radius, y, x + width - radius, y);
gp.AddArc(x + width - radius, y, radius, radius, 270, 90);
gp.AddLine(x + width, y + radius, x + width, y + height - radius);
gp.AddArc(x + width - radius, y + height - radius, radius, radius, 0, 90);
gp.AddLine(x + width - radius, y + height, x + radius, y + height);
gp.AddArc(x, y + height - radius, radius, radius, 90, 90);
gp.AddLine(x, y + height - radius, x, y + radius);
gp.AddArc(x, y, radius, radius, 180, 90);
gp.CloseFigure();
}
return gp;
}
public static Brush createFluffyBrush(GraphicsPath gp, float[] blendPositions, float[] blendFactors)
{
PathGradientBrush pgb = new PathGradientBrush(gp);
//Blend blend = new Blend();
//blend.Positions = blendPositions;
//blend.Factors = blendFactors;
//pgb.Blend = blend;
//pgb.CenterColor = Color.White;
//pgb.SurroundColors = new Color[] { Color.Black };
return pgb;
}
public enum ChannelARGB
{
Blue = 0,
Green = 1,
Red = 2,
Alpha = 3
}
public static void transferOneARGBChannelFromOneBitmapToAnother(Bitmap source, Bitmap dest, ChannelARGB sourceChannel, ChannelARGB destChannel)
{
if (source.Size != dest.Size)
throw new ArgumentException();
Rectangle r = new Rectangle(System.Drawing.Point.Empty, source.Size);
BitmapData bdSrc = source.LockBits(r, ImageLockMode.ReadOnly, PixelFormat.Format32bppArgb);
BitmapData bdDst = dest.LockBits(r, ImageLockMode.ReadWrite, PixelFormat.Format32bppArgb);
unsafe
{
byte* bpSrc = (byte*)bdSrc.Scan0.ToPointer();
byte* bpDst = (byte*)bdDst.Scan0.ToPointer();
bpSrc += (int)sourceChannel;
bpDst += (int)destChannel;
for (int i = r.Height * r.Width; i > 0; i--)
{
*bpDst = *bpSrc;
bpSrc += 4;
bpDst += 4;
}
}
source.UnlockBits(bdSrc);
dest.UnlockBits(bdDst);
}
private void FrmImageEditor_Resize(object sender, EventArgs e)
{
resizePictureBox();
}
}
}
......@@ -48,7 +48,6 @@
this.cbxResolution = new System.Windows.Forms.ComboBox();
this.btnSwitch = new System.Windows.Forms.Button();
this.plVsp = new System.Windows.Forms.Panel();
this.vspCamView = new Kivii.Sample.ImageUploader.Controls.VideoSourcePlayer();
this.plRight = new System.Windows.Forms.Panel();
this.gbPhotoList = new System.Windows.Forms.GroupBox();
this.flpPhotos = new System.Windows.Forms.FlowLayoutPanel();
......@@ -63,8 +62,9 @@
this.gbOperating = new System.Windows.Forms.GroupBox();
this.btnShot = new System.Windows.Forms.Button();
this.btnCanon = new System.Windows.Forms.Button();
this.btnEditor = new System.Windows.Forms.Button();
this.btnDelete = new System.Windows.Forms.Button();
this.btnEditor = new System.Windows.Forms.Button();
this.vspCamView = new Kivii.Sample.ImageUploader.Controls.VideoSourcePlayer();
this.plLeft.SuspendLayout();
this.gbSample.SuspendLayout();
this.plSearchReport.SuspendLayout();
......@@ -88,8 +88,9 @@
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(252, 681);
this.plLeft.Size = new System.Drawing.Size(378, 1022);
this.plLeft.TabIndex = 0;
//
// gbSample
......@@ -97,9 +98,11 @@
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, 320);
this.gbSample.Location = new System.Drawing.Point(0, 423);
this.gbSample.Margin = new System.Windows.Forms.Padding(4);
this.gbSample.Name = "gbSample";
this.gbSample.Size = new System.Drawing.Size(252, 199);
this.gbSample.Padding = new System.Windows.Forms.Padding(4);
this.gbSample.Size = new System.Drawing.Size(378, 356);
this.gbSample.TabIndex = 3;
this.gbSample.TabStop = false;
this.gbSample.Text = "查询样品";
......@@ -108,10 +111,9 @@
//
this.rtbMessage.Dock = System.Windows.Forms.DockStyle.Fill;
this.rtbMessage.Font = new System.Drawing.Font("宋体", 14F);
this.rtbMessage.Location = new System.Drawing.Point(3, 54);
this.rtbMessage.Margin = new System.Windows.Forms.Padding(2);
this.rtbMessage.Location = new System.Drawing.Point(4, 81);
this.rtbMessage.Name = "rtbMessage";
this.rtbMessage.Size = new System.Drawing.Size(246, 142);
this.rtbMessage.Size = new System.Drawing.Size(370, 271);
this.rtbMessage.TabIndex = 20;
this.rtbMessage.Text = "";
//
......@@ -120,9 +122,10 @@
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(3, 17);
this.plSearchReport.Location = new System.Drawing.Point(4, 25);
this.plSearchReport.Margin = new System.Windows.Forms.Padding(4);
this.plSearchReport.Name = "plSearchReport";
this.plSearchReport.Size = new System.Drawing.Size(246, 37);
this.plSearchReport.Size = new System.Drawing.Size(370, 56);
this.plSearchReport.TabIndex = 19;
//
// tbxReportId
......@@ -130,9 +133,10 @@
this.tbxReportId.Dock = System.Windows.Forms.DockStyle.Fill;
this.tbxReportId.Font = new System.Drawing.Font("宋体", 12F);
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(187, 37);
this.tbxReportId.Size = new System.Drawing.Size(282, 56);
this.tbxReportId.TabIndex = 7;
this.tbxReportId.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbxReportId_KeyPress);
//
......@@ -141,9 +145,10 @@
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(187, 0);
this.btnReportId.Location = new System.Drawing.Point(282, 0);
this.btnReportId.Margin = new System.Windows.Forms.Padding(4);
this.btnReportId.Name = "btnReportId";
this.btnReportId.Size = new System.Drawing.Size(59, 37);
this.btnReportId.Size = new System.Drawing.Size(88, 56);
this.btnReportId.TabIndex = 8;
this.btnReportId.Text = "查询";
this.btnReportId.UseVisualStyleBackColor = false;
......@@ -160,9 +165,11 @@
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, 519);
this.gbLogin.Location = new System.Drawing.Point(0, 779);
this.gbLogin.Margin = new System.Windows.Forms.Padding(4);
this.gbLogin.Name = "gbLogin";
this.gbLogin.Size = new System.Drawing.Size(252, 162);
this.gbLogin.Padding = new System.Windows.Forms.Padding(4);
this.gbLogin.Size = new System.Drawing.Size(378, 243);
this.gbLogin.TabIndex = 2;
this.gbLogin.TabStop = false;
this.gbLogin.Text = "系统登录";
......@@ -172,9 +179,10 @@
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(147, 114);
this.btnLogout.Location = new System.Drawing.Point(220, 171);
this.btnLogout.Margin = new System.Windows.Forms.Padding(4);
this.btnLogout.Name = "btnLogout";
this.btnLogout.Size = new System.Drawing.Size(96, 40);
this.btnLogout.Size = new System.Drawing.Size(144, 60);
this.btnLogout.TabIndex = 31;
this.btnLogout.Text = "退 出";
this.btnLogout.UseVisualStyleBackColor = false;
......@@ -185,9 +193,10 @@
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(3, 113);
this.btnLogin.Location = new System.Drawing.Point(4, 170);
this.btnLogin.Margin = new System.Windows.Forms.Padding(4);
this.btnLogin.Name = "btnLogin";
this.btnLogin.Size = new System.Drawing.Size(136, 40);
this.btnLogin.Size = new System.Drawing.Size(204, 60);
this.btnLogin.TabIndex = 30;
this.btnLogin.Text = "登 录";
this.btnLogin.UseVisualStyleBackColor = false;
......@@ -196,10 +205,11 @@
// tbxPassword
//
this.tbxPassword.Font = new System.Drawing.Font("宋体", 12F);
this.tbxPassword.Location = new System.Drawing.Point(64, 78);
this.tbxPassword.Location = new System.Drawing.Point(96, 117);
this.tbxPassword.Margin = new System.Windows.Forms.Padding(4);
this.tbxPassword.Name = "tbxPassword";
this.tbxPassword.PasswordChar = '*';
this.tbxPassword.Size = new System.Drawing.Size(179, 26);
this.tbxPassword.Size = new System.Drawing.Size(266, 35);
this.tbxPassword.TabIndex = 29;
this.tbxPassword.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.tbxPassword_KeyPress);
//
......@@ -207,27 +217,30 @@
//
this.lblPassword.AutoSize = true;
this.lblPassword.Font = new System.Drawing.Font("宋体", 12F);
this.lblPassword.Location = new System.Drawing.Point(2, 81);
this.lblPassword.Location = new System.Drawing.Point(3, 122);
this.lblPassword.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(63, 16);
this.lblPassword.Size = new System.Drawing.Size(94, 24);
this.lblPassword.TabIndex = 28;
this.lblPassword.Text = "密 码:";
//
// tbxUserName
//
this.tbxUserName.Font = new System.Drawing.Font("宋体", 12F);
this.tbxUserName.Location = new System.Drawing.Point(64, 46);
this.tbxUserName.Location = new System.Drawing.Point(96, 69);
this.tbxUserName.Margin = new System.Windows.Forms.Padding(4);
this.tbxUserName.Name = "tbxUserName";
this.tbxUserName.Size = new System.Drawing.Size(179, 26);
this.tbxUserName.Size = new System.Drawing.Size(266, 35);
this.tbxUserName.TabIndex = 27;
//
// lblUser
//
this.lblUser.AutoSize = true;
this.lblUser.Font = new System.Drawing.Font("宋体", 12F);
this.lblUser.Location = new System.Drawing.Point(2, 49);
this.lblUser.Location = new System.Drawing.Point(3, 74);
this.lblUser.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblUser.Name = "lblUser";
this.lblUser.Size = new System.Drawing.Size(63, 16);
this.lblUser.Size = new System.Drawing.Size(94, 24);
this.lblUser.TabIndex = 26;
this.lblUser.Text = "用户名:";
//
......@@ -235,18 +248,20 @@
//
this.tbxServiceUrl.BackColor = System.Drawing.SystemColors.Window;
this.tbxServiceUrl.Font = new System.Drawing.Font("宋体", 12F);
this.tbxServiceUrl.Location = new System.Drawing.Point(64, 14);
this.tbxServiceUrl.Location = new System.Drawing.Point(96, 21);
this.tbxServiceUrl.Margin = new System.Windows.Forms.Padding(4);
this.tbxServiceUrl.Name = "tbxServiceUrl";
this.tbxServiceUrl.Size = new System.Drawing.Size(179, 26);
this.tbxServiceUrl.Size = new System.Drawing.Size(266, 35);
this.tbxServiceUrl.TabIndex = 25;
//
// lblUrl
//
this.lblUrl.AutoSize = true;
this.lblUrl.Font = new System.Drawing.Font("宋体", 12F);
this.lblUrl.Location = new System.Drawing.Point(2, 17);
this.lblUrl.Location = new System.Drawing.Point(3, 26);
this.lblUrl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.lblUrl.Name = "lblUrl";
this.lblUrl.Size = new System.Drawing.Size(63, 16);
this.lblUrl.Size = new System.Drawing.Size(94, 24);
this.lblUrl.TabIndex = 22;
this.lblUrl.Text = "地 址:";
//
......@@ -258,8 +273,10 @@
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.Size = new System.Drawing.Size(252, 320);
this.gbCamView.Padding = new System.Windows.Forms.Padding(4);
this.gbCamView.Size = new System.Drawing.Size(378, 423);
this.gbCamView.TabIndex = 0;
this.gbCamView.TabStop = false;
this.gbCamView.Text = "相机视图";
......@@ -269,9 +286,10 @@
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.Location = new System.Drawing.Point(4, 377);
this.cbxResolution.Margin = new System.Windows.Forms.Padding(4);
this.cbxResolution.Name = "cbxResolution";
this.cbxResolution.Size = new System.Drawing.Size(187, 32);
this.cbxResolution.Size = new System.Drawing.Size(282, 44);
this.cbxResolution.TabIndex = 5;
this.cbxResolution.SelectedIndexChanged += new System.EventHandler(this.cbxResolution_SelectedIndexChanged);
//
......@@ -280,9 +298,10 @@
this.btnSwitch.BackColor = System.Drawing.SystemColors.ButtonHighlight;
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.Location = new System.Drawing.Point(190, 285);
this.btnSwitch.Location = new System.Drawing.Point(286, 377);
this.btnSwitch.Margin = new System.Windows.Forms.Padding(4);
this.btnSwitch.Name = "btnSwitch";
this.btnSwitch.Size = new System.Drawing.Size(59, 32);
this.btnSwitch.Size = new System.Drawing.Size(88, 42);
this.btnSwitch.TabIndex = 4;
this.btnSwitch.Text = "切换";
this.btnSwitch.UseVisualStyleBackColor = false;
......@@ -292,29 +311,21 @@
//
this.plVsp.Controls.Add(this.vspCamView);
this.plVsp.Dock = System.Windows.Forms.DockStyle.Top;
this.plVsp.Location = new System.Drawing.Point(3, 19);
this.plVsp.Location = new System.Drawing.Point(4, 27);
this.plVsp.Margin = new System.Windows.Forms.Padding(4);
this.plVsp.Name = "plVsp";
this.plVsp.Size = new System.Drawing.Size(246, 266);
this.plVsp.Size = new System.Drawing.Size(370, 350);
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
//
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(793, 0);
this.plRight.Location = new System.Drawing.Point(1190, 0);
this.plRight.Margin = new System.Windows.Forms.Padding(4);
this.plRight.Name = "plRight";
this.plRight.Size = new System.Drawing.Size(151, 681);
this.plRight.Size = new System.Drawing.Size(226, 1022);
this.plRight.TabIndex = 1;
//
// gbPhotoList
......@@ -323,8 +334,10 @@
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.Size = new System.Drawing.Size(151, 597);
this.gbPhotoList.Padding = new System.Windows.Forms.Padding(4);
this.gbPhotoList.Size = new System.Drawing.Size(226, 904);
this.gbPhotoList.TabIndex = 2;
this.gbPhotoList.TabStop = false;
this.gbPhotoList.Text = "已拍照片";
......@@ -335,19 +348,21 @@
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(3, 19);
this.flpPhotos.Location = new System.Drawing.Point(4, 27);
this.flpPhotos.Margin = new System.Windows.Forms.Padding(0);
this.flpPhotos.Name = "flpPhotos";
this.flpPhotos.Size = new System.Drawing.Size(145, 575);
this.flpPhotos.Size = new System.Drawing.Size(218, 873);
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, 597);
this.gbUploading.Location = new System.Drawing.Point(0, 904);
this.gbUploading.Margin = new System.Windows.Forms.Padding(4);
this.gbUploading.Name = "gbUploading";
this.gbUploading.Size = new System.Drawing.Size(151, 84);
this.gbUploading.Padding = new System.Windows.Forms.Padding(4);
this.gbUploading.Size = new System.Drawing.Size(226, 118);
this.gbUploading.TabIndex = 1;
this.gbUploading.TabStop = false;
this.gbUploading.Text = "操作台";
......@@ -357,9 +372,10 @@
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(3, 17);
this.btnUpload.Location = new System.Drawing.Point(4, 25);
this.btnUpload.Margin = new System.Windows.Forms.Padding(4);
this.btnUpload.Name = "btnUpload";
this.btnUpload.Size = new System.Drawing.Size(145, 64);
this.btnUpload.Size = new System.Drawing.Size(218, 89);
this.btnUpload.TabIndex = 3;
this.btnUpload.Text = "上传";
this.btnUpload.UseVisualStyleBackColor = false;
......@@ -371,9 +387,10 @@
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(252, 0);
this.plMain.Location = new System.Drawing.Point(378, 0);
this.plMain.Margin = new System.Windows.Forms.Padding(4);
this.plMain.Name = "plMain";
this.plMain.Size = new System.Drawing.Size(541, 681);
this.plMain.Size = new System.Drawing.Size(812, 1022);
this.plMain.TabIndex = 2;
//
// gbPhotoView
......@@ -383,8 +400,10 @@
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.Size = new System.Drawing.Size(541, 602);
this.gbPhotoView.Padding = new System.Windows.Forms.Padding(4);
this.gbPhotoView.Size = new System.Drawing.Size(812, 904);
this.gbPhotoView.TabIndex = 1;
this.gbPhotoView.TabStop = false;
this.gbPhotoView.Text = "选中照片";
......@@ -393,29 +412,34 @@
//
this.ptbPhotoDisplay.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.ptbPhotoDisplay.Dock = System.Windows.Forms.DockStyle.Fill;
this.ptbPhotoDisplay.Location = new System.Drawing.Point(3, 19);
this.ptbPhotoDisplay.Location = new System.Drawing.Point(4, 27);
this.ptbPhotoDisplay.Margin = new System.Windows.Forms.Padding(4);
this.ptbPhotoDisplay.Name = "ptbPhotoDisplay";
this.ptbPhotoDisplay.Size = new System.Drawing.Size(535, 552);
this.ptbPhotoDisplay.Size = new System.Drawing.Size(804, 831);
this.ptbPhotoDisplay.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.ptbPhotoDisplay.TabIndex = 4;
this.ptbPhotoDisplay.TabStop = false;
//
// plDisplay
//
this.plDisplay.Controls.Add(this.btnEditor);
this.plDisplay.Controls.Add(this.btnCamearTurn);
this.plDisplay.Controls.Add(this.lbDisplay);
this.plDisplay.Dock = System.Windows.Forms.DockStyle.Bottom;
this.plDisplay.Location = new System.Drawing.Point(3, 571);
this.plDisplay.Location = new System.Drawing.Point(4, 858);
this.plDisplay.Margin = new System.Windows.Forms.Padding(4);
this.plDisplay.Name = "plDisplay";
this.plDisplay.Size = new System.Drawing.Size(535, 28);
this.plDisplay.Size = new System.Drawing.Size(804, 42);
this.plDisplay.TabIndex = 3;
//
// btnCamearTurn
//
this.btnCamearTurn.Dock = System.Windows.Forms.DockStyle.Right;
this.btnCamearTurn.Location = new System.Drawing.Point(447, 0);
this.btnCamearTurn.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCamearTurn.Location = new System.Drawing.Point(672, 0);
this.btnCamearTurn.Margin = new System.Windows.Forms.Padding(4);
this.btnCamearTurn.Name = "btnCamearTurn";
this.btnCamearTurn.Size = new System.Drawing.Size(88, 28);
this.btnCamearTurn.Size = new System.Drawing.Size(132, 42);
this.btnCamearTurn.TabIndex = 31;
this.btnCamearTurn.Text = "旋转";
this.btnCamearTurn.UseVisualStyleBackColor = true;
......@@ -427,8 +451,9 @@
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(63, 14);
this.lbDisplay.Size = new System.Drawing.Size(89, 20);
this.lbDisplay.TabIndex = 0;
this.lbDisplay.Text = "照片名称";
//
......@@ -436,12 +461,13 @@
//
this.gbOperating.Controls.Add(this.btnShot);
this.gbOperating.Controls.Add(this.btnCanon);
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, 602);
this.gbOperating.Location = new System.Drawing.Point(0, 904);
this.gbOperating.Margin = new System.Windows.Forms.Padding(4);
this.gbOperating.Name = "gbOperating";
this.gbOperating.Size = new System.Drawing.Size(541, 79);
this.gbOperating.Padding = new System.Windows.Forms.Padding(4);
this.gbOperating.Size = new System.Drawing.Size(812, 118);
this.gbOperating.TabIndex = 0;
this.gbOperating.TabStop = false;
this.gbOperating.Text = "操作台";
......@@ -452,9 +478,10 @@
this.btnShot.Dock = System.Windows.Forms.DockStyle.Fill;
this.btnShot.Font = new System.Drawing.Font("宋体", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnShot.ForeColor = System.Drawing.SystemColors.ControlText;
this.btnShot.Location = new System.Drawing.Point(3, 17);
this.btnShot.Location = new System.Drawing.Point(4, 25);
this.btnShot.Margin = new System.Windows.Forms.Padding(4);
this.btnShot.Name = "btnShot";
this.btnShot.Size = new System.Drawing.Size(247, 59);
this.btnShot.Size = new System.Drawing.Size(516, 89);
this.btnShot.TabIndex = 7;
this.btnShot.Text = "拍照";
this.btnShot.UseVisualStyleBackColor = false;
......@@ -466,52 +493,68 @@
this.btnCanon.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.btnCanon.Dock = System.Windows.Forms.DockStyle.Right;
this.btnCanon.Font = new System.Drawing.Font("宋体", 25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.btnCanon.Location = new System.Drawing.Point(250, 17);
this.btnCanon.Location = new System.Drawing.Point(520, 25);
this.btnCanon.Margin = new System.Windows.Forms.Padding(4);
this.btnCanon.Name = "btnCanon";
this.btnCanon.Size = new System.Drawing.Size(96, 59);
this.btnCanon.Size = new System.Drawing.Size(144, 89);
this.btnCanon.TabIndex = 6;
this.btnCanon.Text = "佳能";
this.btnCanon.UseVisualStyleBackColor = false;
this.btnCanon.Visible = false;
this.btnCanon.EnabledChanged += new System.EventHandler(this.btnEnabled_EnabledChanged);
this.btnCanon.Click += new System.EventHandler(this.btnCanon_Click);
//
// btnEditor
//
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(346, 17);
this.btnEditor.Name = "btnEditor";
this.btnEditor.Size = new System.Drawing.Size(96, 59);
this.btnEditor.TabIndex = 4;
this.btnEditor.Text = "裁剪";
this.btnEditor.UseVisualStyleBackColor = false;
this.btnEditor.EnabledChanged += new System.EventHandler(this.btnEnabled_EnabledChanged);
this.btnEditor.Click += new System.EventHandler(this.btnEditor_Click);
//
// btnDelete
//
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(442, 17);
this.btnDelete.Location = new System.Drawing.Point(664, 25);
this.btnDelete.Margin = new System.Windows.Forms.Padding(4);
this.btnDelete.Name = "btnDelete";
this.btnDelete.Size = new System.Drawing.Size(96, 59);
this.btnDelete.Size = new System.Drawing.Size(144, 89);
this.btnDelete.TabIndex = 2;
this.btnDelete.Text = "删除";
this.btnDelete.UseVisualStyleBackColor = false;
this.btnDelete.EnabledChanged += new System.EventHandler(this.btnEnabled_EnabledChanged);
this.btnDelete.Click += new System.EventHandler(this.btnDelete_Click);
//
// btnEditor
//
this.btnEditor.BackColor = System.Drawing.SystemColors.ButtonHighlight;
this.btnEditor.Dock = System.Windows.Forms.DockStyle.Right;
this.btnEditor.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Bold);
this.btnEditor.Location = new System.Drawing.Point(528, 0);
this.btnEditor.Margin = new System.Windows.Forms.Padding(4);
this.btnEditor.Name = "btnEditor";
this.btnEditor.Size = new System.Drawing.Size(144, 42);
this.btnEditor.TabIndex = 32;
this.btnEditor.Text = "裁剪";
this.btnEditor.UseVisualStyleBackColor = false;
this.btnEditor.EnabledChanged += new System.EventHandler(this.btnEnabled_EnabledChanged);
this.btnEditor.Click += new System.EventHandler(this.btnEditor_Click);
//
// 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(370, 350);
this.vspCamView.TabIndex = 0;
this.vspCamView.Text = "vspCamView";
this.vspCamView.VideoSource = null;
//
// FrmMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(944, 681);
this.ClientSize = new System.Drawing.Size(1416, 1022);
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);
......@@ -570,11 +613,11 @@
private System.Windows.Forms.PictureBox ptbPhotoDisplay;
private System.Windows.Forms.Panel plDisplay;
private System.Windows.Forms.Label lbDisplay;
private System.Windows.Forms.Button btnEditor;
private System.Windows.Forms.Button btnCamearTurn;
private System.Windows.Forms.ComboBox cbxResolution;
private System.Windows.Forms.Button btnCanon;
private System.Windows.Forms.Button btnShot;
private System.Windows.Forms.Button btnEditor;
}
}
......@@ -75,7 +75,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Configs.cs" />
<Compile Include="Controls\ImageResizer.cs">
<Compile Include="Controls\PanelEx.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Controls\VideoSourcePlayer.cs">
......@@ -136,7 +136,7 @@
<Content Include="Camera.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Kivii.Client.Canon\Src\Kivii.Client.Canon.V4.5.csproj">
<ProjectReference Include="..\..\Kivii.Client.Canon.V4.5\Src\Kivii.Client.Canon.V4.5.csproj">
<Project>{08fa5081-59f1-4e6a-b44c-309ef67159e6}</Project>
<Name>Kivii.Client.Canon.V4.5</Name>
</ProjectReference>
......
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