✅作者简介:大家好,我是 Meteors., 向往着更加简洁高效的代码写法与编程方式,持续分享Java技术内容。
????个人主页:Meteors.的博客
????当前专栏:小项目
✨特色专栏: 知识分享
????本文内容:使用C#实现VS窗体应用——画图板
???? ** ps ** : 阅读文章如果有问题或者疑惑,欢迎在评论区提问或指出。
目录
一. 界面
二. 绘制图形
三. 修改颜色
四. 铅笔工具
五. 颜料桶
六. 橡皮擦
七. 图像彩色
八. 撤销
九. 重做
十. 文件保存
十一. 文件打开
十二. 套索操作(比较粗糙)
十三. 美白(由RGB更改实现)
十四. 透明(由透明度变化实现):
十五. 源码分享
主要有十三个功能模块:1、绘制图形功能 2、编辑颜色功能 3、显示颜色值功能 4、铅笔工具 5、颜料桶填充功能 6、橡皮擦工具功能7、撤销功能8、重做操作功能9、保存文件功能10、打开文件功能11、套索选中像素功能12、选中区域美白功能13、修改像素透明度功能
一. 界面
主要代码:
namespace 画图板程序
{
partial class Form1
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
btnPen = new Button();
btnPigmentBucket = new Button();
button3 = new Button();
btnEraser = new Button();
btnColorExtractor = new Button();
button6 = new Button();
trackBarWidth = new TrackBar();
pictureBox1 = new PictureBox();
tableLayoutPanel1 = new TableLayoutPanel();
groupBox1 = new GroupBox();
groupBox2 = new GroupBox();
comboBox1 = new ComboBox();
btnDrawEllipse = new Button();
panel8 = new Panel();
btnDrawLine = new Button();
btnDrawDiamond = new Button();
btnDrawRectangle = new Button();
btnDrawTriangle = new Button();
btnDrawHexagon = new Button();
btnDrawPentagon = new Button();
btnDrawCircle = new Button();
panelColor = new Panel();
btnYellow = new TableLayoutPanel();
label1 = new Label();
tableLayoutPanel4 = new TableLayoutPanel();
rbtnBlack = new RoundButton();
rbtnWhite = new RoundButton();
rbtnGray = new RoundButton();
rbtnGreen = new RoundButton();
rbtnRed = new RoundButton();
rbtnLightBlue = new RoundButton();
rBtnOrange = new RoundButton();
rbtnBlue = new RoundButton();
rbtnYellow = new RoundButton();
rbtnPurple = new RoundButton();
panel1 = new Panel();
btnSelectColor = new RoundButton();
panel6 = new Panel();
panel7 = new Panel();
tableLayoutPanel3 = new TableLayoutPanel();
labelColor2 = new Label();
panelCurColor1 = new Panel();
rbtnCurColor2 = new RoundButton();
panelCurColor2 = new Panel();
rbtnCurColor = new RoundButton();
labelColor1 = new Label();
groupBox3 = new GroupBox();
button5 = new Button();
button2 = new Button();
button1 = new Button();
button4 = new Button();
btnChangeOpacity = new Button();
btnWhiten = new Button();
btnLasso = new Button();
panelBoundaryLine = new Panel();
groupBox4 = new GroupBox();
panel10 = new Panel();
btnRedo = new Button();
btnUndo = new Button();
roundButton11 = new RoundButton();
colorDialog1 = new ColorDialog();
panelDrawingArea = new Panel();
tableLayoutPanel2 = new TableLayoutPanel();
menuStrip1 = new MenuStrip();
文件ToolStripMenuItem = new ToolStripMenuItem();
导入ToolStripMenuItem = new ToolStripMenuItem();
导出ToolStripMenuItem = new ToolStripMenuItem();
编辑ToolStripMenuItem = new ToolStripMenuItem();
复制ToolStripMenuItem = new ToolStripMenuItem();
剪切CtrlXToolStripMenuItem = new ToolStripMenuItem();
粘贴CtrlvToolStripMenuItem = new ToolStripMenuItem();
旋转ToolStripMenuItem = new ToolStripMenuItem();
顺时针旋转90ToolStripMenuItem = new ToolStripMenuItem();
顺时针旋转180ToolStripMenuItem = new ToolStripMenuItem();
逆时针旋转90ToolStripMenuItem = new ToolStripMenuItem();
逆时针旋转180ToolStripMenuItem = new ToolStripMenuItem();
查看ToolStripMenuItem = new ToolStripMenuItem();
保存ToolStripMenuItem = new ToolStripMenuItem();
panel2 = new Panel();
panel5 = new Panel();
buttonSizeFitWindow = new Button();
comboBoxCanvasSize = new ComboBox();
trackBarCanvasSize = new TrackBar();
btnBottomShrink = new Button();
btnBottomEnlarge = new Button();
panelButtomLeft2 = new Panel();
panel4 = new Panel();
labelColorB = new Label();
panelB = new Panel();
labelColorG = new Label();
label2 = new Label();
labelColorR = new Label();
panelG = new Panel();
panelR = new Panel();
panelButtomLeft1 = new Panel();
panel3 = new Panel();
labelYShow = new Label();
labelY = new Label();
labelXShow = new Label();
labelCoordinate = new Label();
labelX = new Label();
((System.ComponentModel.ISupportInitialize)trackBarWidth).BeginInit();
((System.ComponentModel.ISupportInitialize)pictureBox1).BeginInit();
tableLayoutPanel1.SuspendLayout();
groupBox1.SuspendLayout();
groupBox2.SuspendLayout();
panelColor.SuspendLayout();
btnYellow.SuspendLayout();
tableLayoutPanel4.SuspendLayout();
panel1.SuspendLayout();
panel6.SuspendLayout();
tableLayoutPanel3.SuspendLayout();
panelCurColor1.SuspendLayout();
panelCurColor2.SuspendLayout();
groupBox3.SuspendLayout();
groupBox4.SuspendLayout();
panelDrawingArea.SuspendLayout();
tableLayoutPanel2.SuspendLayout();
menuStrip1.SuspendLayout();
panel2.SuspendLayout();
panel5.SuspendLayout();
((System.ComponentModel.ISupportInitialize)trackBarCanvasSize).BeginInit();
panelButtomLeft2.SuspendLayout();
panelButtomLeft1.SuspendLayout();
SuspendLayout();
//
// btnPen
//
btnPen.Image = Properties.Resources.qianbi2;
btnPen.Location = new Point(6, 30);
btnPen.Name = "btnPen";
btnPen.Size = new Size(54, 50);
btnPen.TabIndex = 0;
btnPen.UseVisualStyleBackColor = true;
btnPen.Click += BtnStartDrawing_Click;
//
// btnPigmentBucket
//
btnPigmentBucket.Image = (Image)resources.GetObject("btnPigmentBucket.Image");
btnPigmentBucket.Location = new Point(80, 30);
btnPigmentBucket.Name = "btnPigmentBucket";
btnPigmentBucket.Size = new Size(54, 50);
btnPigmentBucket.TabIndex = 1;
btnPigmentBucket.UseVisualStyleBackColor = true;
btnPigmentBucket.Click += button2_Click;
//
// button3
//
button3.Image = (Image)resources.GetObject("button3.Image");
button3.Location = new Point(151, 30);
button3.Name = "button3";
button3.Size = new Size(54, 50);
button3.TabIndex = 2;
button3.UseVisualStyleBackColor = true;
button3.Click += button3_Click;
//
// btnEraser
//
btnEraser.Image = (Image)resources.GetObject("btnEraser.Image");
btnEraser.Location = new Point(6, 88);
btnEraser.Name = "btnEraser";
btnEraser.Size = new Size(54, 50);
btnEraser.TabIndex = 3;
btnEraser.UseVisualStyleBackColor = true;
btnEraser.Click += BtnEraser_Click;
//
// btnColorExtractor
//
btnColorExtractor.Image = (Image)resources.GetObject("btnColorExtractor.Image");
btnColorExtractor.Location = new Point(80, 88);
btnColorExtractor.Name = "btnColorExtractor";
btnColorExtractor.Size = new Size(54, 50);
btnColorExtractor.TabIndex = 4;
btnColorExtractor.UseVisualStyleBackColor = true;
btnColorExtractor.Click += btnColorExtractor_Click;
//
// button6
//
button6.Image = Properties.Resources.fangdajing1;
button6.Location = new Point(151, 88);
button6.Name = "button6";
button6.Size = new Size(54, 50);
button6.TabIndex = 5;
button6.UseVisualStyleBackColor = true;
button6.Click += button6_Click;
//
// trackBarWidth
//
trackBarWidth.BackColor = Color.FromArgb(192, 192, 255);
trackBarWidth.Location = new Point(3, 37);
trackBarWidth.Name = "trackBarWidth";
trackBarWidth.Orientation = Orientation.Vertical;
trackBarWidth.Size = new Size(33, 264);
trackBarWidth.TabIndex = 8;
trackBarWidth.Scroll += TrackBarWidth_Scroll;
//
// pictureBox1
//
pictureBox1.BackColor = Color.FromArgb(192, 192, 255);
pictureBox1.Image = (Image)resources.GetObject("pictureBox1.Image");
pictureBox1.Location = new Point(3, 3);
pictureBox1.Name = "pictureBox1";
pictureBox1.Size = new Size(31, 28);
pictureBox1.TabIndex = 9;
pictureBox1.TabStop = false;
//
// tableLayoutPanel1
//
tableLayoutPanel1.ColumnCount = 6;
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 22.58F));
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 14.29F));
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 21.29F));
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 24.29F));
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 14.29F));
tableLayoutPanel1.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 3.29F));
tableLayoutPanel1.Controls.Add(groupBox1, 1, 0);
tableLayoutPanel1.Controls.Add(groupBox2, 2, 0);
tableLayoutPanel1.Controls.Add(panelColor, 3, 0);
tableLayoutPanel1.Controls.Add(groupBox3, 0, 0);
tableLayoutPanel1.Controls.Add(groupBox4, 4, 0);
tableLayoutPanel1.Dock = DockStyle.Top;
tableLayoutPanel1.Location = new Point(0, 32);
tableLayoutPanel1.Name = "tableLayoutPanel1";
tableLayoutPanel1.RowCount = 1;
tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel1.Size = new Size(2046, 147);
tableLayoutPanel1.TabIndex = 10;
tableLayoutPanel1.Paint += tableLayoutPanel1_Paint_1;
//
// groupBox1
//
groupBox1.Controls.Add(button6);
groupBox1.Controls.Add(btnEraser);
groupBox1.Controls.Add(button3);
groupBox1.Controls.Add(btnColorExtractor);
groupBox1.Controls.Add(btnPen);
groupBox1.Controls.Add(btnPigmentBucket);
groupBox1.Location = new Point(464, 3);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(216, 141);
groupBox1.TabIndex = 6;
groupBox1.TabStop = false;
groupBox1.Text = "工具";
//
// groupBox2
//
groupBox2.BackColor = Color.FromArgb(192, 192, 255);
groupBox2.Controls.Add(comboBox1);
groupBox2.Controls.Add(btnDrawEllipse);
groupBox2.Controls.Add(panel8);
groupBox2.Controls.Add(btnDrawLine);
groupBox2.Controls.Add(btnDrawDiamond);
groupBox2.Controls.Add(btnDrawRectangle);
groupBox2.Controls.Add(btnDrawTriangle);
groupBox2.Controls.Add(btnDrawHexagon);
groupBox2.Controls.Add(btnDrawPentagon);
groupBox2.Controls.Add(btnDrawCircle);
groupBox2.Location = new Point(756, 3);
groupBox2.Name = "groupBox2";
groupBox2.Size = new Size(429, 141);
groupBox2.TabIndex = 7;
groupBox2.TabStop = false;
groupBox2.Text = "形状";
//
// comboBox1
//
comboBox1.DropDownStyle = ComboBoxStyle.DropDownList;
comboBox1.FormattingEnabled = true;
comboBox1.Location = new Point(286, 29);
comboBox1.Name = "comboBox1";
comboBox1.Size = new Size(120, 32);
comboBox1.TabIndex = 8;
comboBox1.SelectedIndexChanged += comboBox1_SelectedIndexChanged;
//
// btnDrawEllipse
//
btnDrawEllipse.Image = Properties.Resources.ellipse1;
btnDrawEllipse.Location = new Point(30, 86);
btnDrawEllipse.Name = "btnDrawEllipse";
btnDrawEllipse.Size = new Size(52, 40);
btnDrawEllipse.TabIndex = 0;
btnDrawEllipse.UseVisualStyleBackColor = true;
btnDrawEllipse.Click += btnDrawEllipse_Click;
//
// panel8
//
panel8.BackColor = Color.Gray;
panel8.Location = new Point(265, 18);
panel8.Name = "panel8";
panel8.Size = new Size(1, 116);
panel8.TabIndex = 12;
//
// btnDrawLine
//
btnDrawLine.Image = Properties.Resources.line1;
btnDrawLine.Location = new Point(30, 40);
btnDrawLine.Name = "btnDrawLine";
btnDrawLine.Size = new Size(52, 40);
btnDrawLine.TabIndex = 2;
btnDrawLine.UseVisualStyleBackColor = true;
btnDrawLine.Click += btnDrawLine_Click;
//
// btnDrawDiamond
//
btnDrawDiamond.Image = Properties.Resources.tubiao1;
btnDrawDiamond.Location = new Point(204, 86);
btnDrawDiamond.Name = "btnDrawDiamond";
btnDrawDiamond.Size = new Size(52, 40);
btnDrawDiamond.TabIndex = 7;
btnDrawDiamond.UseVisualStyleBackColor = true;
btnDrawDiamond.Click += btnDrawDiamond_Click;
//
// btnDrawRectangle
//
btnDrawRectangle.Image = Properties.Resources.juxing1;
btnDrawRectangle.Location = new Point(146, 40);
btnDrawRectangle.Name = "btnDrawRectangle";
btnDrawRectangle.Size = new Size(52, 40);
btnDrawRectangle.TabIndex = 1;
btnDrawRectangle.UseVisualStyleBackColor = true;
//
// btnDrawTriangle
//
btnDrawTriangle.Image = Properties.Resources.xingzhuang_sanjiaoxing1;
btnDrawTriangle.Location = new Point(88, 40);
btnDrawTriangle.Name = "btnDrawTriangle";
btnDrawTriangle.Size = new Size(52, 40);
btnDrawTriangle.TabIndex = 6;
btnDrawTriangle.UseVisualStyleBackColor = true;
btnDrawTriangle.Click += btnDrawTriangle_Click;
//
// btnDrawHexagon
//
btnDrawHexagon.Image = Properties.Resources.tx_liubianxing1;
btnDrawHexagon.Location = new Point(146, 86);
btnDrawHexagon.Name = "btnDrawHexagon";
btnDrawHexagon.Size = new Size(52, 40);
btnDrawHexagon.TabIndex = 5;
btnDrawHexagon.UseVisualStyleBackColor = true;
btnDrawHexagon.Click += btnDrawHexagon_Click;
//
// btnDrawPentagon
//
btnDrawPentagon.Image = Properties.Resources.pentagon_1;
btnDrawPentagon.Location = new Point(88, 86);
btnDrawPentagon.Name = "btnDrawPentagon";
btnDrawPentagon.Size = new Size(52, 40);
btnDrawPentagon.TabIndex = 3;
btnDrawPentagon.UseVisualStyleBackColor = true;
btnDrawPentagon.Click += btnDrawPentagon_Click;
//
// btnDrawCircle
//
btnDrawCircle.Image = Properties.Resources.radio_on1;
btnDrawCircle.Location = new Point(204, 40);
btnDrawCircle.Name = "btnDrawCircle";
btnDrawCircle.Size = new Size(52, 40);
btnDrawCircle.TabIndex = 4;
btnDrawCircle.UseVisualStyleBackColor = true;
btnDrawCircle.Click += btnDrawCircle_Click;
//
// panelColor
//
panelColor.BorderStyle = BorderStyle.FixedSingle;
panelColor.Controls.Add(btnYellow);
panelColor.Dock = DockStyle.Fill;
panelColor.Location = new Point(1191, 3);
panelColor.Name = "panelColor";
panelColor.Size = new Size(490, 141);
panelColor.TabIndex = 10;
panelColor.Paint += panelColor_Paint;
//
// btnYellow
//
btnYellow.ColumnCount = 2;
btnYellow.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 25.2049179F));
btnYellow.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 74.79508F));
btnYellow.Controls.Add(label1, 1, 1);
btnYellow.Controls.Add(tableLayoutPanel4, 2, 0);
btnYellow.Controls.Add(panel1, 0, 1);
btnYellow.Controls.Add(panel6, 0, 0);
btnYellow.Dock = DockStyle.Fill;
btnYellow.ForeColor = SystemColors.ControlText;
btnYellow.Location = new Point(0, 0);
btnYellow.Name = "btnYellow";
btnYellow.RowCount = 2;
btnYellow.RowStyles.Add(new RowStyle(SizeType.Percent, 63.3802834F));
btnYellow.RowStyles.Add(new RowStyle(SizeType.Percent, 36.6197166F));
btnYellow.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
btnYellow.Size = new Size(488, 139);
btnYellow.TabIndex = 8;
btnYellow.Paint += btnYellow_Paint;
//
// label1
//
label1.AutoSize = true;
label1.Dock = DockStyle.Fill;
label1.Location = new Point(126, 88);
label1.Name = "label1";
label1.Size = new Size(359, 51);
label1.TabIndex = 0;
label1.Text = "选择";
label1.TextAlign = ContentAlignment.MiddleCenter;
//
// tableLayoutPanel4
//
tableLayoutPanel4.BackColor = Color.FromArgb(192, 192, 255);
tableLayoutPanel4.ColumnCount = 5;
tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 20F));
tableLayoutPanel4.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 20F));
tableLayoutPanel4.Controls.Add(rbtnBlack, 0, 0);
tableLayoutPanel4.Controls.Add(rbtnWhite, 0, 1);
tableLayoutPanel4.Controls.Add(rbtnGray, 1, 0);
tableLayoutPanel4.Controls.Add(rbtnGreen, 1, 1);
tableLayoutPanel4.Controls.Add(rbtnRed, 2, 0);
tableLayoutPanel4.Controls.Add(rbtnLightBlue, 2, 1);
tableLayoutPanel4.Controls.Add(rBtnOrange, 3, 0);
tableLayoutPanel4.Controls.Add(rbtnBlue, 3, 1);
tableLayoutPanel4.Controls.Add(rbtnYellow, 4, 0);
tableLayoutPanel4.Controls.Add(rbtnPurple, 4, 1);
tableLayoutPanel4.Location = new Point(126, 3);
tableLayoutPanel4.Name = "tableLayoutPanel4";
tableLayoutPanel4.RowCount = 2;
tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel4.RowStyles.Add(new RowStyle(SizeType.Absolute, 20F));
tableLayoutPanel4.Size = new Size(359, 82);
tableLayoutPanel4.TabIndex = 2;
tableLayoutPanel4.Paint += tableLayoutPanel4_Paint;
//
// rbtnBlack
//
rbtnBlack.BackColor = Color.Black;
rbtnBlack.BorderColor = Color.White;
rbtnBlack.Dock = DockStyle.Fill;
rbtnBlack.FlatAppearance.BorderSize = 0;
rbtnBlack.FlatStyle = FlatStyle.Flat;
rbtnBlack.Location = new Point(3, 3);
rbtnBlack.Name = "rbtnBlack";
rbtnBlack.Size = new Size(35, 35);
rbtnBlack.TabIndex = 0;
rbtnBlack.UseVisualStyleBackColor = false;
//
// rbtnWhite
//
rbtnWhite.AutoSize = true;
rbtnWhite.BackColor = Color.White;
rbtnWhite.BorderColor = Color.White;
rbtnWhite.Dock = DockStyle.Fill;
rbtnWhite.FlatAppearance.BorderSize = 0;
rbtnWhite.FlatStyle = FlatStyle.Flat;
rbtnWhite.Location = new Point(3, 44);
rbtnWhite.Name = "rbtnWhite";
rbtnWhite.Size = new Size(35, 35);
rbtnWhite.TabIndex = 1;
rbtnWhite.UseVisualStyleBackColor = false;
//
// rbtnGray
//
rbtnGray.BackColor = Color.Silver;
rbtnGray.BorderColor = Color.White;
rbtnGray.Dock = DockStyle.Fill;
rbtnGray.FlatAppearance.BorderSize = 0;
rbtnGray.FlatStyle = FlatStyle.Flat;
rbtnGray.Location = new Point(74, 3);
rbtnGray.Name = "rbtnGray";
rbtnGray.Size = new Size(35, 35);
rbtnGray.TabIndex = 2;
rbtnGray.UseVisualStyleBackColor = false;
//
// rbtnGreen
//
rbtnGreen.BackColor = Color.Lime;
rbtnGreen.BorderColor = Color.White;
rbtnGreen.Dock = DockStyle.Fill;
rbtnGreen.FlatAppearance.BorderSize = 0;
rbtnGreen.FlatStyle = FlatStyle.Flat;
rbtnGreen.Location = new Point(74, 44);
rbtnGreen.Name = "rbtnGreen";
rbtnGreen.Size = new Size(35, 35);
rbtnGreen.TabIndex = 3;
rbtnGreen.UseVisualStyleBackColor = false;
//
// rbtnRed
//
rbtnRed.BackColor = Color.Red;
rbtnRed.BorderColor = Color.White;
rbtnRed.Dock = DockStyle.Fill;
rbtnRed.FlatAppearance.BorderSize = 0;
rbtnRed.FlatStyle = FlatStyle.Flat;
rbtnRed.Location = new Point(145, 3);
rbtnRed.Name = "rbtnRed";
rbtnRed.Size = new Size(35, 35);
rbtnRed.TabIndex = 4;
rbtnRed.UseVisualStyleBackColor = false;
//
// rbtnLightBlue
//
rbtnLightBlue.BackColor = Color.Cyan;
rbtnLightBlue.BorderColor = Color.White;
rbtnLightBlue.Dock = DockStyle.Fill;
rbtnLightBlue.FlatAppearance.BorderSize = 0;
rbtnLightBlue.FlatStyle = FlatStyle.Flat;
rbtnLightBlue.Location = new Point(145, 44);
rbtnLightBlue.Name = "rbtnLightBlue";
rbtnLightBlue.Size = new Size(35, 35);
rbtnLightBlue.TabIndex = 5;
rbtnLightBlue.UseVisualStyleBackColor = false;
//
// rBtnOrange
//
rBtnOrange.BackColor = Color.FromArgb(255, 128, 0);
rBtnOrange.BorderColor = Color.White;
rBtnOrange.Dock = DockStyle.Fill;
rBtnOrange.FlatAppearance.BorderSize = 0;
rBtnOrange.FlatStyle = FlatStyle.Flat;
rBtnOrange.Location = new Point(216, 3);
rBtnOrange.Name = "rBtnOrange";
rBtnOrange.Size = new Size(35, 35);
rBtnOrange.TabIndex = 6;
rBtnOrange.UseVisualStyleBackColor = false;
//
// rbtnBlue
//
rbtnBlue.BackColor = Color.Blue;
rbtnBlue.BorderColor = Color.White;
rbtnBlue.Dock = DockStyle.Fill;
rbtnBlue.FlatAppearance.BorderSize = 0;
rbtnBlue.FlatStyle = FlatStyle.Flat;
rbtnBlue.Location = new Point(216, 44);
rbtnBlue.Name = "rbtnBlue";
rbtnBlue.Size = new Size(35, 35);
rbtnBlue.TabIndex = 7;
rbtnBlue.UseVisualStyleBackColor = false;
//
// rbtnYellow
//
rbtnYellow.BackColor = Color.Yellow;
rbtnYellow.BorderColor = Color.White;
rbtnYellow.Dock = DockStyle.Fill;
rbtnYellow.FlatAppearance.BorderSize = 0;
rbtnYellow.FlatStyle = FlatStyle.Flat;
rbtnYellow.Location = new Point(287, 3);
rbtnYellow.Name = "rbtnYellow";
rbtnYellow.Size = new Size(35, 35);
rbtnYellow.TabIndex = 8;
rbtnYellow.UseVisualStyleBackColor = false;
//
// rbtnPurple
//
rbtnPurple.BackColor = Color.Fuchsia;
rbtnPurple.BorderColor = Color.White;
rbtnPurple.Dock = DockStyle.Fill;
rbtnPurple.FlatAppearance.BorderSize = 0;
rbtnPurple.FlatStyle = FlatStyle.Flat;
rbtnPurple.Location = new Point(287, 44);
rbtnPurple.Name = "rbtnPurple";
rbtnPurple.Size = new Size(35, 35);
rbtnPurple.TabIndex = 9;
rbtnPurple.UseVisualStyleBackColor = false;
//
// panel1
//
panel1.Controls.Add(btnSelectColor);
panel1.Dock = DockStyle.Fill;
panel1.Location = new Point(3, 91);
panel1.Name = "panel1";
panel1.Size = new Size(117, 45);
panel1.TabIndex = 3;
//
// btnSelectColor
//
btnSelectColor.BackColor = Color.Transparent;
btnSelectColor.BorderColor = Color.White;
btnSelectColor.FlatAppearance.BorderSize = 0;
btnSelectColor.FlatStyle = FlatStyle.Flat;
btnSelectColor.Image = (Image)resources.GetObject("btnSelectColor.Image");
btnSelectColor.Location = new Point(39, 1);
btnSelectColor.Name = "btnSelectColor";
btnSelectColor.Size = new Size(44, 44);
btnSelectColor.TabIndex = 0;
btnSelectColor.UseVisualStyleBackColor = false;
btnSelectColor.Click += btnSelectColor_Click;
//
// panel6
//
panel6.Controls.Add(panel7);
panel6.Controls.Add(tableLayoutPanel3);
panel6.Location = new Point(3, 3);
panel6.Name = "panel6";
panel6.Size = new Size(117, 82);
panel6.TabIndex = 4;
//
// panel7
//
panel7.BackColor = Color.Black;
panel7.Dock = DockStyle.Right;
panel7.Location = new Point(116, 0);
panel7.Name = "panel7";
panel7.Size = new Size(1, 82);
panel7.TabIndex = 13;
//
// tableLayoutPanel3
//
tableLayoutPanel3.ColumnCount = 2;
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
tableLayoutPanel3.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 49F));
tableLayoutPanel3.Controls.Add(labelColor2, 0, 1);
tableLayoutPanel3.Controls.Add(panelCurColor1, 1, 1);
tableLayoutPanel3.Controls.Add(panelCurColor2, 1, 0);
tableLayoutPanel3.Controls.Add(labelColor1, 0, 0);
tableLayoutPanel3.Location = new Point(-3, 0);
tableLayoutPanel3.Name = "tableLayoutPanel3";
tableLayoutPanel3.RowCount = 2;
tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel3.RowStyles.Add(new RowStyle(SizeType.Percent, 50F));
tableLayoutPanel3.Size = new Size(123, 86);
tableLayoutPanel3.TabIndex = 1;
//
// labelColor2
//
labelColor2.AutoSize = true;
labelColor2.Dock = DockStyle.Fill;
labelColor2.Location = new Point(3, 43);
labelColor2.Name = "labelColor2";
labelColor2.Size = new Size(68, 43);
labelColor2.TabIndex = 12;
labelColor2.Text = "颜色2:";
labelColor2.TextAlign = ContentAlignment.MiddleCenter;
//
// panelCurColor1
//
panelCurColor1.Controls.Add(rbtnCurColor2);
panelCurColor1.Location = new Point(77, 46);
panelCurColor1.Name = "panelCurColor1";
panelCurColor1.Size = new Size(37, 37);
panelCurColor1.TabIndex = 0;
//
// rbtnCurColor2
//
rbtnCurColor2.AutoSize = true;
rbtnCurColor2.BackColor = Color.FromArgb(255, 192, 255);
rbtnCurColor2.BorderColor = Color.White;
rbtnCurColor2.Dock = DockStyle.Fill;
rbtnCurColor2.FlatAppearance.BorderSize = 0;
rbtnCurColor2.FlatStyle = FlatStyle.Flat;
rbtnCurColor2.Location = new Point(0, 0);
rbtnCurColor2.Name = "rbtnCurColor2";
rbtnCurColor2.Size = new Size(37, 37);
rbtnCurColor2.TabIndex = 2;
rbtnCurColor2.UseVisualStyleBackColor = false;
rbtnCurColor2.Click += rbtnCurColor_Click2_Click;
//
// panelCurColor2
//
panelCurColor2.Controls.Add(rbtnCurColor);
panelCurColor2.Location = new Point(77, 3);
panelCurColor2.Name = "panelCurColor2";
panelCurColor2.Size = new Size(37, 37);
panelCurColor2.TabIndex = 1;
//
// rbtnCurColor
//
rbtnCurColor.BackColor = Color.Black;
rbtnCurColor.BorderColor = Color.White;
rbtnCurColor.Dock = DockStyle.Fill;
rbtnCurColor.FlatAppearance.BorderSize = 0;
rbtnCurColor.FlatStyle = FlatStyle.Flat;
rbtnCurColor.Location = new Point(0, 0);
rbtnCurColor.Name = "rbtnCurColor";
rbtnCurColor.Size = new Size(37, 37);
rbtnCurColor.TabIndex = 1;
rbtnCurColor.UseVisualStyleBackColor = false;
rbtnCurColor.Click += rbtnCurColor_Click;
//
// labelColor1
//
labelColor1.AutoSize = true;
labelColor1.Dock = DockStyle.Fill;
labelColor1.Location = new Point(3, 0);
labelColor1.Name = "labelColor1";
labelColor1.Size = new Size(68, 43);
labelColor1.TabIndex = 11;
labelColor1.Text = "颜色1:";
labelColor1.TextAlign = ContentAlignment.MiddleCenter;
labelColor1.Click += labelColor1_Click;
//
// groupBox3
//
groupBox3.Controls.Add(button5);
groupBox3.Controls.Add(button2);
groupBox3.Controls.Add(button1);
groupBox3.Controls.Add(button4);
groupBox3.Controls.Add(btnChangeOpacity);
groupBox3.Controls.Add(btnWhiten);
groupBox3.Controls.Add(btnLasso);
groupBox3.Controls.Add(panelBoundaryLine);
groupBox3.Dock = DockStyle.Left;
groupBox3.Location = new Point(3, 3);
groupBox3.Name = "groupBox3";
groupBox3.Size = new Size(455, 141);
groupBox3.TabIndex = 11;
groupBox3.TabStop = false;
groupBox3.Text = "套索";
//
// button5
//
button5.Image = (Image)resources.GetObject("button5.Image");
button5.Location = new Point(364, 82);
button5.Name = "button5";
button5.Size = new Size(73, 43);
button5.TabIndex = 14;
button5.UseVisualStyleBackColor = true;
button5.Click += button5_Click_1;
//
// button2
//
button2.Image = (Image)resources.GetObject("button2.Image");
button2.Location = new Point(276, 83);
button2.Name = "button2";
button2.Size = new Size(73, 43);
button2.TabIndex = 13;
button2.UseVisualStyleBackColor = true;
//
// button1
//
button1.Image = (Image)resources.GetObject("button1.Image");
button1.Location = new Point(364, 24);
button1.Name = "button1";
button1.Size = new Size(73, 43);
button1.TabIndex = 12;
button1.UseVisualStyleBackColor = true;
button1.Click += button1_Click_2;
//
// button4
//
button4.Image = (Image)resources.GetObject("button4.Image");
button4.Location = new Point(276, 24);
button4.Name = "button4";
button4.Size = new Size(73, 43);
button4.TabIndex = 11;
button4.UseVisualStyleBackColor = true;
button4.Click += button4_Click_1;
//
// btnChangeOpacity
//
btnChangeOpacity.Image = (Image)resources.GetObject("btnChangeOpacity.Image");
btnChangeOpacity.Location = new Point(159, 82);
btnChangeOpacity.Name = "btnChangeOpacity";
btnChangeOpacity.Size = new Size(80, 54);
btnChangeOpacity.TabIndex = 2;
btnChangeOpacity.UseVisualStyleBackColor = true;
btnChangeOpacity.Click += btnChangeOpacity_Click;
//
// btnWhiten
//
btnWhiten.Image = (Image)resources.GetObject("btnWhiten.Image");
btnWhiten.Location = new Point(159, 18);
btnWhiten.Name = "btnWhiten";
btnWhiten.Size = new Size(80, 54);
btnWhiten.TabIndex = 1;
btnWhiten.UseVisualStyleBackColor = true;
btnWhiten.Click += btnWhiten_Click;
//
// btnLasso
//
btnLasso.BackColor = Color.White;
btnLasso.Image = (Image)resources.GetObject("btnLasso.Image");
btnLasso.Location = new Point(26, 40);
btnLasso.Name = "btnLasso";
btnLasso.Size = new Size(107, 74);
btnLasso.TabIndex = 0;
btnLasso.UseVisualStyleBackColor = false;
btnLasso.Click += btnLasso_Click;
//
// panelBoundaryLine
//
panelBoundaryLine.BackColor = Color.Gray;
panelBoundaryLine.Location = new Point(255, 18);
panelBoundaryLine.Name = "panelBoundaryLine";
panelBoundaryLine.Size = new Size(1, 116);
panelBoundaryLine.TabIndex = 11;
//
// groupBox4
//
groupBox4.Controls.Add(panel10);
groupBox4.Controls.Add(btnRedo);
groupBox4.Controls.Add(btnUndo);
groupBox4.Location = new Point(1687, 3);
groupBox4.Name = "groupBox4";
groupBox4.Size = new Size(250, 126);
groupBox4.TabIndex = 12;
groupBox4.TabStop = false;
groupBox4.Text = "操作";
//
// panel10
//
panel10.BackColor = Color.Gray;
panel10.Location = new Point(123, 24);
panel10.Name = "panel10";
panel10.Size = new Size(1, 88);
panel10.TabIndex = 12;
//
// btnRedo
//
btnRedo.Image = (Image)resources.GetObject("btnRedo.Image");
btnRedo.Location = new Point(146, 40);
btnRedo.Name = "btnRedo";
btnRedo.Size = new Size(96, 68);
btnRedo.TabIndex = 1;
btnRedo.UseVisualStyleBackColor = true;
btnRedo.Click += BtnRedo_Click;
//
// btnUndo
//
btnUndo.Image = (Image)resources.GetObject("btnUndo.Image");
btnUndo.Location = new Point(6, 40);
btnUndo.Name = "btnUndo";
btnUndo.Size = new Size(96, 68);
btnUndo.TabIndex = 0;
btnUndo.UseVisualStyleBackColor = true;
btnUndo.Click += BtnUndo_Click;
//
// roundButton11
//
roundButton11.BackColor = Color.Transparent;
roundButton11.BorderColor = Color.White;
roundButton11.FlatStyle = FlatStyle.Flat;
roundButton11.Location = new Point(0, 0);
roundButton11.Name = "roundButton11";
roundButton11.Size = new Size(75, 23);
roundButton11.TabIndex = 0;
roundButton11.UseVisualStyleBackColor = false;
//
// panelDrawingArea
//
panelDrawingArea.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
panelDrawingArea.AutoScroll = true;
panelDrawingArea.BackColor = Color.White;
panelDrawingArea.Controls.Add(tableLayoutPanel2);
panelDrawingArea.Location = new Point(0, 178);
panelDrawingArea.Margin = new Padding(0, 32, 0, 0);
panelDrawingArea.Name = "panelDrawingArea";
panelDrawingArea.Size = new Size(2046, 1002);
panelDrawingArea.TabIndex = 6;
panelDrawingArea.Paint += panel1_Paint;
//
// tableLayoutPanel2
//
tableLayoutPanel2.ColumnCount = 1;
tableLayoutPanel2.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 50F));
tableLayoutPanel2.Controls.Add(trackBarWidth, 0, 1);
tableLayoutPanel2.Controls.Add(pictureBox1, 0, 0);
tableLayoutPanel2.Location = new Point(3, 214);
tableLayoutPanel2.Name = "tableLayoutPanel2";
tableLayoutPanel2.RowCount = 2;
tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Percent, 11.43695F));
tableLayoutPanel2.RowStyles.Add(new RowStyle(SizeType.Percent, 88.56305F));
tableLayoutPanel2.Size = new Size(39, 304);
tableLayoutPanel2.TabIndex = 10;
//
// menuStrip1
//
menuStrip1.ImageScalingSize = new Size(24, 24);
menuStrip1.Items.AddRange(new ToolStripItem[] { 文件ToolStripMenuItem, 编辑ToolStripMenuItem, 查看ToolStripMenuItem, 保存ToolStripMenuItem });
menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Size = new Size(2046, 32);
menuStrip1.TabIndex = 11;
menuStrip1.Text = "menuStrip1";
menuStrip1.ItemClicked += menuStrip1_ItemClicked;
//
// 文件ToolStripMenuItem
//
文件ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { 导入ToolStripMenuItem, 导出ToolStripMenuItem });
文件ToolStripMenuItem.Name = "文件ToolStripMenuItem";
文件ToolStripMenuItem.Size = new Size(84, 28);
文件ToolStripMenuItem.Text = "文件(F)";
//
// 导入ToolStripMenuItem
//
导入ToolStripMenuItem.Name = "导入ToolStripMenuItem";
导入ToolStripMenuItem.Size = new Size(251, 34);
导入ToolStripMenuItem.Text = "打开文件 Ctrl+O";
导入ToolStripMenuItem.Click += openFile;
//
// 导出ToolStripMenuItem
//
导出ToolStripMenuItem.Name = "导出ToolStripMenuItem";
导出ToolStripMenuItem.Size = new Size(251, 34);
导出ToolStripMenuItem.Text = "保存文件 Ctrl+S";
导出ToolStripMenuItem.Click += saveFile;
//
// 编辑ToolStripMenuItem
//
编辑ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { 复制ToolStripMenuItem, 剪切CtrlXToolStripMenuItem, 粘贴CtrlvToolStripMenuItem, 旋转ToolStripMenuItem });
编辑ToolStripMenuItem.Name = "编辑ToolStripMenuItem";
编辑ToolStripMenuItem.Size = new Size(62, 28);
编辑ToolStripMenuItem.Text = "编辑";
//
// 复制ToolStripMenuItem
//
复制ToolStripMenuItem.Name = "复制ToolStripMenuItem";
复制ToolStripMenuItem.Size = new Size(209, 34);
复制ToolStripMenuItem.Text = "复制 Ctrl+c";
//
// 剪切CtrlXToolStripMenuItem
//
剪切CtrlXToolStripMenuItem.Name = "剪切CtrlXToolStripMenuItem";
剪切CtrlXToolStripMenuItem.Size = new Size(209, 34);
剪切CtrlXToolStripMenuItem.Text = "剪切 Ctrl+x";
//
// 粘贴CtrlvToolStripMenuItem
//
粘贴CtrlvToolStripMenuItem.Name = "粘贴CtrlvToolStripMenuItem";
粘贴CtrlvToolStripMenuItem.Size = new Size(209, 34);
粘贴CtrlvToolStripMenuItem.Text = "粘贴 Ctrl+v";
//
// 旋转ToolStripMenuItem
//
旋转ToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { 顺时针旋转90ToolStripMenuItem, 顺时针旋转180ToolStripMenuItem, 逆时针旋转90ToolStripMenuItem, 逆时针旋转180ToolStripMenuItem });
旋转ToolStripMenuItem.Name = "旋转ToolStripMenuItem";
旋转ToolStripMenuItem.Size = new Size(209, 34);
旋转ToolStripMenuItem.Text = "旋转";
//
// 顺时针旋转90ToolStripMenuItem
//
顺时针旋转90ToolStripMenuItem.Name = "顺时针旋转90ToolStripMenuItem";
顺时针旋转90ToolStripMenuItem.Size = new Size(240, 34);
顺时针旋转90ToolStripMenuItem.Text = "顺时针旋转90°";
//
// 顺时针旋转180ToolStripMenuItem
//
顺时针旋转180ToolStripMenuItem.Name = "顺时针旋转180ToolStripMenuItem";
顺时针旋转180ToolStripMenuItem.Size = new Size(240, 34);
顺时针旋转180ToolStripMenuItem.Text = "顺时针旋转180°";
//
// 逆时针旋转90ToolStripMenuItem
//
逆时针旋转90ToolStripMenuItem.Name = "逆时针旋转90ToolStripMenuItem";
逆时针旋转90ToolStripMenuItem.Size = new Size(240, 34);
逆时针旋转90ToolStripMenuItem.Text = "逆时针旋转90°";
//
// 逆时针旋转180ToolStripMenuItem
//
逆时针旋转180ToolStripMenuItem.Name = "逆时针旋转180ToolStripMenuItem";
逆时针旋转180ToolStripMenuItem.Size = new Size(240, 34);
逆时针旋转180ToolStripMenuItem.Text = "逆时针旋转180°";
//
// 查看ToolStripMenuItem
//
查看ToolStripMenuItem.Name = "查看ToolStripMenuItem";
查看ToolStripMenuItem.Size = new Size(62, 28);
查看ToolStripMenuItem.Text = "查看";
//
// 保存ToolStripMenuItem
//
保存ToolStripMenuItem.Name = "保存ToolStripMenuItem";
保存ToolStripMenuItem.Size = new Size(62, 28);
保存ToolStripMenuItem.Text = "保存";
//
// panel2
//
panel2.BackColor = Color.FromArgb(192, 192, 255);
panel2.Controls.Add(panel5);
panel2.Controls.Add(panelButtomLeft2);
panel2.Controls.Add(panelButtomLeft1);
panel2.Dock = DockStyle.Bottom;
panel2.Location = new Point(0, 1180);
panel2.Name = "panel2";
panel2.Size = new Size(2046, 65);
panel2.TabIndex = 12;
//
// panel5
//
panel5.Controls.Add(buttonSizeFitWindow);
panel5.Controls.Add(comboBoxCanvasSize);
panel5.Controls.Add(trackBarCanvasSize);
panel5.Controls.Add(btnBottomShrink);
panel5.Controls.Add(btnBottomEnlarge);
panel5.Dock = DockStyle.Right;
panel5.Location = new Point(1116, 0);
panel5.Name = "panel5";
panel5.Size = new Size(930, 65);
panel5.TabIndex = 1;
panel5.Paint += panel5_Paint;
//
// buttonSizeFitWindow
//
buttonSizeFitWindow.BackgroundImage = (Image)resources.GetObject("buttonSizeFitWindow.BackgroundImage");
buttonSizeFitWindow.Image = (Image)resources.GetObject("buttonSizeFitWindow.Image");
buttonSizeFitWindow.Location = new Point(257, -1);
buttonSizeFitWindow.Name = "buttonSizeFitWindow";
buttonSizeFitWindow.Size = new Size(65, 65);
buttonSizeFitWindow.TabIndex = 3;
buttonSizeFitWindow.UseVisualStyleBackColor = true;
buttonSizeFitWindow.Click += buttonSizeFitWindow_Click;
//
// comboBoxCanvasSize
//
comboBoxCanvasSize.FormattingEnabled = true;
comboBoxCanvasSize.Location = new Point(341, 19);
comboBoxCanvasSize.Name = "comboBoxCanvasSize";
comboBoxCanvasSize.Size = new Size(86, 32);
comboBoxCanvasSize.TabIndex = 2;
comboBoxCanvasSize.SelectedIndexChanged += comboBoxCanvasSize_SelectedIndexChanged;
//
// trackBarCanvasSize
//
trackBarCanvasSize.Location = new Point(504, 23);
trackBarCanvasSize.Name = "trackBarCanvasSize";
trackBarCanvasSize.Size = new Size(333, 69);
trackBarCanvasSize.TabIndex = 0;
trackBarCanvasSize.Scroll += trackBarCanvasSize_Scroll;
//
// btnBottomShrink
//
btnBottomShrink.BackgroundImage = (Image)resources.GetObject("btnBottomShrink.BackgroundImage");
btnBottomShrink.Image = (Image)resources.GetObject("btnBottomShrink.Image");
btnBottomShrink.Location = new Point(433, -1);
btnBottomShrink.Name = "btnBottomShrink";
btnBottomShrink.Size = new Size(65, 65);
btnBottomShrink.TabIndex = 1;
btnBottomShrink.UseVisualStyleBackColor = true;
btnBottomShrink.Click += btnBottomShrink_Click;
//
// btnBottomEnlarge
//
btnBottomEnlarge.BackColor = Color.Transparent;
btnBottomEnlarge.BackgroundImage = (Image)resources.GetObject("btnBottomEnlarge.BackgroundImage");
btnBottomEnlarge.Image = (Image)resources.GetObject("btnBottomEnlarge.Image");
btnBottomEnlarge.Location = new Point(843, -1);
btnBottomEnlarge.Name = "btnBottomEnlarge";
btnBottomEnlarge.Size = new Size(65, 65);
btnBottomEnlarge.TabIndex = 0;
btnBottomEnlarge.UseVisualStyleBackColor = false;
btnBottomEnlarge.Click += btnBottomEnlarge_Click;
//
// panelButtomLeft2
//
panelButtomLeft2.Controls.Add(panel4);
panelButtomLeft2.Controls.Add(labelColorB);
panelButtomLeft2.Controls.Add(panelB);
panelButtomLeft2.Controls.Add(labelColorG);
panelButtomLeft2.Controls.Add(label2);
panelButtomLeft2.Controls.Add(labelColorR);
panelButtomLeft2.Controls.Add(panelG);
panelButtomLeft2.Controls.Add(panelR);
panelButtomLeft2.Dock = DockStyle.Left;
panelButtomLeft2.Location = new Point(429, 0);
panelButtomLeft2.Name = "panelButtomLeft2";
panelButtomLeft2.Size = new Size(594, 65);
panelButtomLeft2.TabIndex = 2;
//
// panel4
//
panel4.BackColor = Color.Black;
panel4.Location = new Point(590, 13);
panel4.Name = "panel4";
panel4.Size = new Size(2, 43);
panel4.TabIndex = 1;
//
// labelColorB
//
labelColorB.Location = new Point(478, 17);
labelColorB.Name = "labelColorB";
labelColorB.Size = new Size(94, 34);
labelColorB.TabIndex = 2;
labelColorB.TextAlign = ContentAlignment.MiddleLeft;
//
// panelB
//
panelB.Location = new Point(432, 13);
panelB.Name = "panelB";
panelB.Size = new Size(40, 40);
panelB.TabIndex = 5;
//
// labelColorG
//
labelColorG.Location = new Point(334, 17);
labelColorG.Name = "labelColorG";
labelColorG.Size = new Size(94, 34);
labelColorG.TabIndex = 1;
labelColorG.TextAlign = ContentAlignment.MiddleLeft;
//
// label2
//
label2.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Bold);
label2.Location = new Point(0, 0);
label2.Name = "label2";
label2.Size = new Size(138, 65);
label2.TabIndex = 2;
label2.Text = "RGB:";
label2.TextAlign = ContentAlignment.MiddleCenter;
//
// labelColorR
//
labelColorR.Location = new Point(190, 13);
labelColorR.Name = "labelColorR";
labelColorR.Size = new Size(94, 36);
labelColorR.TabIndex = 0;
labelColorR.TextAlign = ContentAlignment.MiddleLeft;
//
// panelG
//
panelG.Location = new Point(288, 13);
panelG.Name = "panelG";
panelG.Size = new Size(40, 40);
panelG.TabIndex = 4;
//
// panelR
//
panelR.Location = new Point(144, 13);
panelR.Name = "panelR";
panelR.Size = new Size(40, 40);
panelR.TabIndex = 3;
//
// panelButtomLeft1
//
panelButtomLeft1.Controls.Add(panel3);
panelButtomLeft1.Controls.Add(labelYShow);
panelButtomLeft1.Controls.Add(labelY);
panelButtomLeft1.Controls.Add(labelXShow);
panelButtomLeft1.Controls.Add(labelCoordinate);
panelButtomLeft1.Controls.Add(labelX);
panelButtomLeft1.Dock = DockStyle.Left;
panelButtomLeft1.Location = new Point(0, 0);
panelButtomLeft1.Name = "panelButtomLeft1";
panelButtomLeft1.Size = new Size(429, 65);
panelButtomLeft1.TabIndex = 1;
panelButtomLeft1.Paint += panelButtomLeft1_Paint;
//
// panel3
//
panel3.BackColor = Color.Black;
panel3.Location = new Point(425, 13);
panel3.Name = "panel3";
panel3.Size = new Size(2, 43);
panel3.TabIndex = 0;
//
// labelYShow
//
labelYShow.AutoSize = true;
labelYShow.Location = new Point(258, 23);
labelYShow.Name = "labelYShow";
labelYShow.Size = new Size(0, 24);
labelYShow.TabIndex = 4;
labelYShow.TextAlign = ContentAlignment.MiddleLeft;
//
// labelY
//
labelY.AutoSize = true;
labelY.Font = new Font("Microsoft YaHei UI", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
labelY.Location = new Point(232, 23);
labelY.Name = "labelY";
labelY.Size = new Size(25, 24);
labelY.TabIndex = 3;
labelY.Text = "Y:";
labelY.TextAlign = ContentAlignment.MiddleCenter;
labelY.Click += labelY_Click;
//
// labelXShow
//
labelXShow.AutoSize = true;
labelXShow.Location = new Point(136, 23);
labelXShow.Name = "labelXShow";
labelXShow.Size = new Size(0, 24);
labelXShow.TabIndex = 2;
labelXShow.TextAlign = ContentAlignment.MiddleLeft;
//
// labelCoordinate
//
labelCoordinate.Font = new Font("Microsoft YaHei UI", 12F, FontStyle.Bold);
labelCoordinate.Location = new Point(0, 0);
labelCoordinate.Name = "labelCoordinate";
labelCoordinate.Size = new Size(101, 65);
labelCoordinate.TabIndex = 0;
labelCoordinate.Text = "坐标:";
labelCoordinate.TextAlign = ContentAlignment.MiddleCenter;
labelCoordinate.Click += labelCoordinate_Click;
//
// labelX
//
labelX.AutoSize = true;
labelX.Location = new Point(107, 23);
labelX.Name = "labelX";
labelX.Size = new Size(26, 24);
labelX.TabIndex = 1;
labelX.Text = "X:";
labelX.TextAlign = ContentAlignment.MiddleCenter;
//
// Form1
//
AutoScaleDimensions = new SizeF(11F, 24F);
AutoScaleMode = AutoScaleMode.Font;
BackColor = Color.FromArgb(192, 192, 255);
ClientSize = new Size(2046, 1245);
Controls.Add(panel2);
Controls.Add(panelDrawingArea);
Controls.Add(tableLayoutPanel1);
Controls.Add(menuStrip1);
DoubleBuffered = true;
Icon = (Icon)resources.GetObject("$this.Icon");
KeyPreview = true;
MainMenuStrip = menuStrip1;
Name = "Form1";
StartPosition = FormStartPosition.CenterParent;
Text = "画图板";
Load += Form1_Load;
KeyDown += Form1_KeyDown;
((System.ComponentModel.ISupportInitialize)trackBarWidth).EndInit();
((System.ComponentModel.ISupportInitialize)pictureBox1).EndInit();
tableLayoutPanel1.ResumeLayout(false);
groupBox1.ResumeLayout(false);
groupBox2.ResumeLayout(false);
panelColor.ResumeLayout(false);
btnYellow.ResumeLayout(false);
btnYellow.PerformLayout();
tableLayoutPanel4.ResumeLayout(false);
tableLayoutPanel4.PerformLayout();
panel1.ResumeLayout(false);
panel6.ResumeLayout(false);
tableLayoutPanel3.ResumeLayout(false);
tableLayoutPanel3.PerformLayout();
panelCurColor1.ResumeLayout(false);
panelCurColor1.PerformLayout();
panelCurColor2.ResumeLayout(false);
groupBox3.ResumeLayout(false);
groupBox4.ResumeLayout(false);
panelDrawingArea.ResumeLayout(false);
tableLayoutPanel2.ResumeLayout(false);
tableLayoutPanel2.PerformLayout();
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
panel2.ResumeLayout(false);
panel5.ResumeLayout(false);
panel5.PerformLayout();
((System.ComponentModel.ISupportInitialize)trackBarCanvasSize).EndInit();
panelButtomLeft2.ResumeLayout(false);
panelButtomLeft1.ResumeLayout(false);
panelButtomLeft1.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
#endregion
private Button btnPen;
private Button btnPigmentBucket;
private Button button3;
private Button btnEraser;
private Button btnColorExtractor;
private Button button6;
private TrackBar trackBarWidth;
private TableLayoutPanel tableLayoutPanel1;
private GroupBox groupBox1;
private GroupBox groupBox2;
private Button btnDrawRectangle;
private Button btnDrawEllipse;
private Button btnDrawDiamond;
private Button btnDrawTriangle;
private Button btnDrawHexagon;
private Button btnDrawCircle;
private Button btnDrawPentagon;
private Button btnDrawLine;
private ComboBox comboBox1;
private TableLayoutPanel btnYellow;
private Label label1;
private ColorDialog colorDialog1;
private TableLayoutPanel tableLayoutPanel3;
private RoundButton rbtnCurColor;
private RoundButton rbtnCurColor2;
private TableLayoutPanel tableLayoutPanel4;
private Panel panelCurColor1;
private Panel panelCurColor2;
private RoundButton rbtnBlack;
private RoundButton rbtnWhite;
private RoundButton rbtnGray;
private RoundButton rbtnGreen;
private RoundButton rbtnRed;
private RoundButton rbtnLightBlue;
private RoundButton rBtnOrange;
private RoundButton rbtnBlue;
private RoundButton rbtnYellow;
private RoundButton rbtnPurple;
private RoundButton roundButton11;
private Panel panelDrawingArea;
private RoundButton btnSelectColor;
private Panel panel1;
private Panel panelColor;
private MenuStrip menuStrip1;
private ToolStripMenuItem 文件ToolStripMenuItem;
private ToolStripMenuItem 导入ToolStripMenuItem;
private ToolStripMenuItem 导出ToolStripMenuItem;
private ToolStripMenuItem 编辑ToolStripMenuItem;
private ToolStripMenuItem 查看ToolStripMenuItem;
private ToolStripMenuItem 保存ToolStripMenuItem;
private GroupBox groupBox3;
private Button btnLasso;
private Button btnUndo;
private GroupBox groupBox4;
private Button btnRedo;
private PictureBox pictureBox1;
private Panel panel2;
private Label labelX;
private Label labelCoordinate;
private Panel panelButtomLeft1;
private Label labelXShow;
private Label labelY;
private Label labelYShow;
private Label label2;
private Panel panelButtomLeft2;
private Panel panelB;
private Panel panelG;
private Panel panelR;
private Label labelColorB;
private Label labelColorG;
private Label labelColorR;
private Panel panel3;
private Panel panel4;
private Panel panel5;
private Button btnBottomEnlarge;
private Button btnBottomShrink;
private TrackBar trackBarCanvasSize;
private Button buttonSizeFitWindow;
private ComboBox comboBoxCanvasSize;
private TableLayoutPanel tableLayoutPanel2;
private Panel panelBoundaryLine;
private Button btnChangeOpacity;
private Button btnWhiten;
private Panel panel8;
private Panel panel10;
private Panel panel6;
private Panel panel7;
private Label labelColor1;
private Label labelColor2;
private Button button4;
private Button button5;
private Button button2;
private Button button1;
private ToolStripMenuItem 复制ToolStripMenuItem;
private ToolStripMenuItem 剪切CtrlXToolStripMenuItem;
private ToolStripMenuItem 粘贴CtrlvToolStripMenuItem;
private ToolStripMenuItem 旋转ToolStripMenuItem;
private ToolStripMenuItem 顺时针旋转90ToolStripMenuItem;
private ToolStripMenuItem 顺时针旋转180ToolStripMenuItem;
private ToolStripMenuItem 逆时针旋转90ToolStripMenuItem;
private ToolStripMenuItem 逆时针旋转180ToolStripMenuItem;
}
}
二. 绘制图形
代码:
private void Panel1_MouseUp(object sender, MouseEventArgs e)
{
if (_choicePen)
{
_isDrawing = false;
startPoint = null;
}
else if (_choiceEraser)
{
_isErasing = false;
startPoint = null;
}
else if (_isDraging)
{
if (e.Button == MouseButtons.Left && startPoint.HasValue) // 左键释放
{
using