Compare commits

..

2 Commits

Author SHA1 Message Date
Maxluli a464514745 Edited the layers auto generated controls 2022-06-15 14:37:56 +02:00
Maxluli 942185c3b4 More Ui tweaks 2022-06-15 14:00:51 +02:00
4 changed files with 110 additions and 80 deletions
+35 -29
View File
@@ -58,7 +58,7 @@
// //
this.pbxColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31))))); this.pbxColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31)))));
this.pbxColor.Location = new System.Drawing.Point(13, 13); this.pbxColor.Location = new System.Drawing.Point(13, 13);
this.pbxColor.Margin = new System.Windows.Forms.Padding(4); this.pbxColor.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.pbxColor.Name = "pbxColor"; this.pbxColor.Name = "pbxColor";
this.pbxColor.Size = new System.Drawing.Size(255, 255); this.pbxColor.Size = new System.Drawing.Size(255, 255);
this.pbxColor.TabIndex = 0; this.pbxColor.TabIndex = 0;
@@ -70,9 +70,9 @@
// //
this.pbxSelectedColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31))))); this.pbxSelectedColor.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31)))));
this.pbxSelectedColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.pbxSelectedColor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pbxSelectedColor.Location = new System.Drawing.Point(326, 205); this.pbxSelectedColor.Location = new System.Drawing.Point(311, 189);
this.pbxSelectedColor.Name = "pbxSelectedColor"; this.pbxSelectedColor.Name = "pbxSelectedColor";
this.pbxSelectedColor.Size = new System.Drawing.Size(100, 100); this.pbxSelectedColor.Size = new System.Drawing.Size(116, 116);
this.pbxSelectedColor.TabIndex = 4; this.pbxSelectedColor.TabIndex = 4;
this.pbxSelectedColor.TabStop = false; this.pbxSelectedColor.TabStop = false;
this.pbxSelectedColor.Click += new System.EventHandler(this.pbxSelectedColor_Click); this.pbxSelectedColor.Click += new System.EventHandler(this.pbxSelectedColor_Click);
@@ -81,16 +81,16 @@
// //
this.nupRed.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.nupRed.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.nupRed.BorderStyle = System.Windows.Forms.BorderStyle.None; this.nupRed.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.nupRed.Font = new System.Drawing.Font("Cascadia Code", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.nupRed.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nupRed.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.nupRed.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.nupRed.Location = new System.Drawing.Point(348, 12); this.nupRed.Location = new System.Drawing.Point(336, 58);
this.nupRed.Maximum = new decimal(new int[] { this.nupRed.Maximum = new decimal(new int[] {
255, 255,
0, 0,
0, 0,
0}); 0});
this.nupRed.Name = "nupRed"; this.nupRed.Name = "nupRed";
this.nupRed.Size = new System.Drawing.Size(78, 27); this.nupRed.Size = new System.Drawing.Size(91, 25);
this.nupRed.TabIndex = 11; this.nupRed.TabIndex = 11;
this.nupRed.ValueChanged += new System.EventHandler(this.nupValueChanged); this.nupRed.ValueChanged += new System.EventHandler(this.nupValueChanged);
// //
@@ -98,16 +98,16 @@
// //
this.nupGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.nupGreen.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.nupGreen.BorderStyle = System.Windows.Forms.BorderStyle.None; this.nupGreen.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.nupGreen.Font = new System.Drawing.Font("Cascadia Code", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.nupGreen.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nupGreen.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.nupGreen.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.nupGreen.Location = new System.Drawing.Point(348, 46); this.nupGreen.Location = new System.Drawing.Point(336, 89);
this.nupGreen.Maximum = new decimal(new int[] { this.nupGreen.Maximum = new decimal(new int[] {
255, 255,
0, 0,
0, 0,
0}); 0});
this.nupGreen.Name = "nupGreen"; this.nupGreen.Name = "nupGreen";
this.nupGreen.Size = new System.Drawing.Size(78, 27); this.nupGreen.Size = new System.Drawing.Size(91, 25);
this.nupGreen.TabIndex = 16; this.nupGreen.TabIndex = 16;
this.nupGreen.ValueChanged += new System.EventHandler(this.nupValueChanged); this.nupGreen.ValueChanged += new System.EventHandler(this.nupValueChanged);
// //
@@ -115,16 +115,16 @@
// //
this.nupBlue.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.nupBlue.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.nupBlue.BorderStyle = System.Windows.Forms.BorderStyle.None; this.nupBlue.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.nupBlue.Font = new System.Drawing.Font("Cascadia Code", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.nupBlue.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nupBlue.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.nupBlue.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.nupBlue.Location = new System.Drawing.Point(348, 79); this.nupBlue.Location = new System.Drawing.Point(336, 120);
this.nupBlue.Maximum = new decimal(new int[] { this.nupBlue.Maximum = new decimal(new int[] {
255, 255,
0, 0,
0, 0,
0}); 0});
this.nupBlue.Name = "nupBlue"; this.nupBlue.Name = "nupBlue";
this.nupBlue.Size = new System.Drawing.Size(78, 27); this.nupBlue.Size = new System.Drawing.Size(91, 25);
this.nupBlue.TabIndex = 17; this.nupBlue.TabIndex = 17;
this.nupBlue.ValueChanged += new System.EventHandler(this.nupValueChanged); this.nupBlue.ValueChanged += new System.EventHandler(this.nupValueChanged);
// //
@@ -132,16 +132,16 @@
// //
this.nupGamma.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.nupGamma.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.nupGamma.BorderStyle = System.Windows.Forms.BorderStyle.None; this.nupGamma.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.nupGamma.Font = new System.Drawing.Font("Cascadia Code", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.nupGamma.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.nupGamma.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.nupGamma.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.nupGamma.Location = new System.Drawing.Point(348, 112); this.nupGamma.Location = new System.Drawing.Point(336, 151);
this.nupGamma.Maximum = new decimal(new int[] { this.nupGamma.Maximum = new decimal(new int[] {
255, 255,
0, 0,
0, 0,
0}); 0});
this.nupGamma.Name = "nupGamma"; this.nupGamma.Name = "nupGamma";
this.nupGamma.Size = new System.Drawing.Size(78, 27); this.nupGamma.Size = new System.Drawing.Size(91, 25);
this.nupGamma.TabIndex = 18; this.nupGamma.TabIndex = 18;
this.nupGamma.ValueChanged += new System.EventHandler(this.nupValueChanged); this.nupGamma.ValueChanged += new System.EventHandler(this.nupValueChanged);
// //
@@ -149,18 +149,20 @@
// //
this.tbxColorHex.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.tbxColorHex.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.tbxColorHex.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tbxColorHex.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxColorHex.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.tbxColorHex.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.tbxColorHex.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.tbxColorHex.Location = new System.Drawing.Point(326, 155); this.tbxColorHex.Location = new System.Drawing.Point(311, 14);
this.tbxColorHex.Name = "tbxColorHex"; this.tbxColorHex.Name = "tbxColorHex";
this.tbxColorHex.Size = new System.Drawing.Size(100, 27); this.tbxColorHex.Size = new System.Drawing.Size(116, 29);
this.tbxColorHex.TabIndex = 20; this.tbxColorHex.TabIndex = 20;
this.tbxColorHex.Text = "#FFFFFF";
this.tbxColorHex.TextChanged += new System.EventHandler(this.tbxColorHex_TextChanged); this.tbxColorHex.TextChanged += new System.EventHandler(this.tbxColorHex_TextChanged);
this.tbxColorHex.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxColorHex_KeyDown); this.tbxColorHex.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbxColorHex_KeyDown);
// //
// pbxSliderRed // pbxSliderRed
// //
this.pbxSliderRed.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31))))); this.pbxSliderRed.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(31)))), ((int)(((byte)(31)))), ((int)(((byte)(31)))));
this.pbxSliderRed.Location = new System.Drawing.Point(12, 275); this.pbxSliderRed.Location = new System.Drawing.Point(11, 275);
this.pbxSliderRed.Name = "pbxSliderRed"; this.pbxSliderRed.Name = "pbxSliderRed";
this.pbxSliderRed.Size = new System.Drawing.Size(255, 30); this.pbxSliderRed.Size = new System.Drawing.Size(255, 30);
this.pbxSliderRed.TabIndex = 21; this.pbxSliderRed.TabIndex = 21;
@@ -182,40 +184,44 @@
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label1.Location = new System.Drawing.Point(322, 15); this.label1.Location = new System.Drawing.Point(308, 57);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(20, 22); this.label1.Size = new System.Drawing.Size(24, 22);
this.label1.TabIndex = 23; this.label1.TabIndex = 23;
this.label1.Text = "R"; this.label1.Text = "R";
// //
// label2 // label2
// //
this.label2.AutoSize = true; this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.label2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label2.Location = new System.Drawing.Point(322, 49); this.label2.Location = new System.Drawing.Point(307, 88);
this.label2.Name = "label2"; this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(20, 22); this.label2.Size = new System.Drawing.Size(25, 22);
this.label2.TabIndex = 24; this.label2.TabIndex = 24;
this.label2.Text = "G"; this.label2.Text = "G";
// //
// label3 // label3
// //
this.label3.AutoSize = true; this.label3.AutoSize = true;
this.label3.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.label3.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label3.Location = new System.Drawing.Point(322, 82); this.label3.Location = new System.Drawing.Point(307, 119);
this.label3.Name = "label3"; this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(20, 22); this.label3.Size = new System.Drawing.Size(23, 22);
this.label3.TabIndex = 25; this.label3.TabIndex = 25;
this.label3.Text = "B"; this.label3.Text = "B";
// //
// label4 // label4
// //
this.label4.AutoSize = true; this.label4.AutoSize = true;
this.label4.Font = new System.Drawing.Font("Arial", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.label4.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.label4.Location = new System.Drawing.Point(322, 115); this.label4.Location = new System.Drawing.Point(308, 150);
this.label4.Name = "label4"; this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(20, 22); this.label4.Size = new System.Drawing.Size(23, 22);
this.label4.TabIndex = 26; this.label4.TabIndex = 26;
this.label4.Text = "A"; this.label4.Text = "A";
// //
@@ -231,10 +237,10 @@
// //
// ColorPicker // ColorPicker
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(10F, 22F); this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 18F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(34)))), ((int)(((byte)(34)))), ((int)(((byte)(34))))); this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(34)))), ((int)(((byte)(34)))), ((int)(((byte)(34)))));
this.ClientSize = new System.Drawing.Size(440, 316); this.ClientSize = new System.Drawing.Size(433, 314);
this.Controls.Add(this.label4); this.Controls.Add(this.label4);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.label2); this.Controls.Add(this.label2);
@@ -252,7 +258,7 @@
this.Font = new System.Drawing.Font("Cascadia Code", 10.2F); this.Font = new System.Drawing.Font("Cascadia Code", 10.2F);
this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(214)))), ((int)(((byte)(214))))); this.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(214)))), ((int)(((byte)(214)))), ((int)(((byte)(214)))));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Margin = new System.Windows.Forms.Padding(4); this.Margin = new System.Windows.Forms.Padding(5, 4, 5, 4);
this.MaximizeBox = false; this.MaximizeBox = false;
this.Name = "ColorPicker"; this.Name = "ColorPicker";
this.Text = "ColorPicker"; this.Text = "ColorPicker";
+4 -4
View File
@@ -303,7 +303,7 @@
this.nupPencilWidth.BorderStyle = System.Windows.Forms.BorderStyle.None; this.nupPencilWidth.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.nupPencilWidth.Font = new System.Drawing.Font("Cascadia Code", 15F); this.nupPencilWidth.Font = new System.Drawing.Font("Cascadia Code", 15F);
this.nupPencilWidth.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.nupPencilWidth.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.nupPencilWidth.Location = new System.Drawing.Point(126, 191); this.nupPencilWidth.Location = new System.Drawing.Point(126, 166);
this.nupPencilWidth.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.nupPencilWidth.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.nupPencilWidth.Maximum = new decimal(new int[] { this.nupPencilWidth.Maximum = new decimal(new int[] {
255, 255,
@@ -404,7 +404,7 @@
this.panelTools.Location = new System.Drawing.Point(1014, 6); this.panelTools.Location = new System.Drawing.Point(1014, 6);
this.panelTools.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panelTools.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panelTools.Name = "panelTools"; this.panelTools.Name = "panelTools";
this.panelTools.Size = new System.Drawing.Size(196, 237); this.panelTools.Size = new System.Drawing.Size(196, 232);
this.panelTools.TabIndex = 31; this.panelTools.TabIndex = 31;
// //
// btnEyeDrop // btnEyeDrop
@@ -424,7 +424,7 @@
// //
// pbxSample // pbxSample
// //
this.pbxSample.Location = new System.Drawing.Point(3, 174); this.pbxSample.Location = new System.Drawing.Point(6, 166);
this.pbxSample.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.pbxSample.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.pbxSample.Name = "pbxSample"; this.pbxSample.Name = "pbxSample";
this.pbxSample.Size = new System.Drawing.Size(117, 59); this.pbxSample.Size = new System.Drawing.Size(117, 59);
@@ -540,7 +540,7 @@
this.panel3.Controls.Add(this.btnLayerRemove); this.panel3.Controls.Add(this.btnLayerRemove);
this.panel3.Controls.Add(this.BtnAddLayer); this.panel3.Controls.Add(this.BtnAddLayer);
this.panel3.Controls.Add(this.label2); this.panel3.Controls.Add(this.label2);
this.panel3.Location = new System.Drawing.Point(1014, 247); this.panel3.Location = new System.Drawing.Point(1014, 242);
this.panel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2); this.panel3.Margin = new System.Windows.Forms.Padding(3, 2, 3, 2);
this.panel3.Name = "panel3"; this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(196, 259); this.panel3.Size = new System.Drawing.Size(196, 259);
+53 -45
View File
@@ -21,20 +21,11 @@ namespace Paint_2
public partial class PaintForm : Form public partial class PaintForm : Form
{ {
const int WINDOW_OFFSET = 15; const int WINDOW_OFFSET = 15;
//const string DEFAULT_FILEPATH = "C:/Paint2/Drawings/"; //readonly Font FONT = new Font("Arial", fontSize);
readonly Color FLAT_RED = Color.FromArgb(0xC6, 0x28, 0x28); readonly Color FLAT_RED = Color.FromArgb(0xC6, 0x28, 0x28);
readonly Color FLAT_GREEN = Color.FromArgb(0x00, 0x89, 0x7B); readonly Color FLAT_GREEN = Color.FromArgb(0x00, 0x89, 0x7B);
readonly Color FLAT_GREY1 = Color.FromArgb(0x59, 0x59, 0x59);
//public Sketch sketch;
//List<PaintTool> toolList;
//bool drawing = false;
//bool randomColor = false;
//bool eyeDropping = false;
//Random _random;
private Color _hoveringColor; private Color _hoveringColor;
private Project _project; private Project _project;
private int _selectedLayer; private int _selectedLayer;
@@ -270,22 +261,22 @@ namespace Paint_2
private void BtnAddLayer_Click(object sender, EventArgs e) private void BtnAddLayer_Click(object sender, EventArgs e)
{ {
Project.AddLayer(); SelectedLayers.Add(Project.AddLayer());
DisplayLayers(); DisplayLayers();
RefreshUi(); RefreshUi();
} }
private void DisplayLayers() private void DisplayLayers()
{ {
//I know I know this is not really MVC yet but I will address that int Yoffset = 10;
int Yoffset = 25;
int Xoffset = 10; int Xoffset = 10;
float fontSize = 10;
int blocsCount = 1; Size blocSize = new Size(pnlLayers.Width,pnlLayers.Height/6);
int btnWidth = 75; int blocsCount = 0;
int labelWidth = 70; int btnWidth = (int)(blocSize.Width / 2.7);
int labelWidth = (int)(blocSize.Width / 3.0);
int BtnXoffset = labelWidth; int BtnXoffset = labelWidth;
int ChkXOffset = BtnXoffset + btnWidth + Xoffset / 2; int ChkXOffset = BtnXoffset + btnWidth /*+ Xoffset*/;
int ChkWidth = 20; int ChkWidth = (int)(blocSize.Width / 6.0);
pnlLayers.Controls.Clear(); pnlLayers.Controls.Clear();
@@ -293,32 +284,54 @@ namespace Paint_2
foreach (Sketch layer in layers) foreach (Sketch layer in layers)
{ {
Label name = new Label(); //LABEL LAYER NAME
name.AutoSize = false; Label lblName = new Label();
name.Width = labelWidth; //Style
name.Text = layer.Name; lblName.Name = "lblLayer"+layer.Id;
name.BackColor = Color.Transparent; lblName.Font = new Font("Arial",fontSize);
pnlLayers.Controls.Add(name); lblName.AutoSize = false;
name.Location = new Point(0, blocsCount * Yoffset); lblName.Width = labelWidth;
lblName.Text = layer.Name;
lblName.BackColor = Color.Transparent;
lblName.Location = new Point(0,blocsCount * blocSize.Height + Yoffset);
//Style
//Behaviour
pnlLayers.Controls.Add(lblName);
//Behaviour
Button btn = new Button(); //BUTTON VISIBILITY
btn.Name = "ChkLayerVisible:" + layer.Id; Button BtnVisbility = new Button();
btn.Click += LayerSelection; //Style
BtnVisbility.FlatStyle = FlatStyle.Popup;
BtnVisbility.BackColor = FLAT_GREY1;
BtnVisbility.Location = new Point(BtnXoffset, blocsCount * blocSize.Height + Yoffset / 2);
BtnVisbility.Width = btnWidth;
//Style
//Behaviour
if (Project.LayersToPrint.Contains(layer.Id)) if (Project.LayersToPrint.Contains(layer.Id))
{ {
btn.Text = "Visible"; BtnVisbility.Text = "Visible";
} }
else else
{ {
btn.Text = "Invisible"; BtnVisbility.Text = "Invisible";
} }
pnlLayers.Controls.Add(btn); BtnVisbility.Name = "ChkLayerVisible:" + layer.Id;
btn.BackColor = Color.FromArgb(59, 59, 59); BtnVisbility.Click += LayerSelection;
btn.Location = new Point(BtnXoffset, blocsCount * Yoffset); pnlLayers.Controls.Add(BtnVisbility);
btn.Width = btnWidth; //Behaviour
btn.FlatStyle = FlatStyle.Popup;
//BUTTON LAYER SELECTION
Button chk = new Button(); Button chk = new Button();
//Style
chk.Location = new Point(ChkXOffset, blocsCount * blocSize.Height + Yoffset / 2);
chk.AutoSize = false;
chk.Text = "";
chk.FlatStyle = FlatStyle.Popup;
chk.Width = ChkWidth;
chk.Name = "ChkLayerSelected:" + layer.Id;
//Style
//Behaviour
chk.Click += LayerCheck; chk.Click += LayerCheck;
if (SelectedLayers.Contains(layer.Id)) if (SelectedLayers.Contains(layer.Id))
{ {
@@ -329,19 +342,14 @@ namespace Paint_2
chk.BackColor = Color.Red; chk.BackColor = Color.Red;
} }
pnlLayers.Controls.Add(chk); pnlLayers.Controls.Add(chk);
chk.Location = new Point(ChkXOffset, blocsCount * Yoffset); //Behaviour
chk.AutoSize = false;
chk.Text = "";
chk.FlatStyle = FlatStyle.Popup;
chk.Width = ChkWidth;
chk.Name = "ChkLayerSelected:" + layer.Id;
blocsCount++; blocsCount++;
} }
} }
private void LayerSelection(object sender, EventArgs e) private void LayerSelection(object sender, EventArgs e)
{ {
//We assume that the id of the layer is the name of the button //We know that the button's name is ChkLayerVisible:... ... being the GUID of the layer
Button btn = sender as Button; Button btn = sender as Button;
string rawId = btn.Name; string rawId = btn.Name;
string id = rawId.Replace("ChkLayerVisible:", String.Empty); string id = rawId.Replace("ChkLayerVisible:", String.Empty);
@@ -350,7 +358,7 @@ namespace Paint_2
} }
private void LayerCheck(object sender, EventArgs e) private void LayerCheck(object sender, EventArgs e)
{ {
// We should receive "CheckBox:937r9837r893" //We know that the button's name is ChkLayerSelected:... ... being the GUID of the layer
Button btn = sender as Button; Button btn = sender as Button;
//MessageBox.Show("Btn " + btn.Name + " pressed"); //MessageBox.Show("Btn " + btn.Name + " pressed");
string rawId = btn.Name; string rawId = btn.Name;
+18 -2
View File
@@ -54,7 +54,7 @@ namespace Paint_2
AddLayer(); AddLayer();
LayersToPrint.Add(Layers[0].Id); LayersToPrint.Add(Layers[0].Id);
} }
public void AddLayer() public string AddLayer()
{ {
List<PaintTool> newTools = new List<PaintTool>(); List<PaintTool> newTools = new List<PaintTool>();
foreach (PaintTool tool in AvaibleTools) foreach (PaintTool tool in AvaibleTools)
@@ -63,7 +63,22 @@ namespace Paint_2
} }
uniqIdGenerator = Guid.NewGuid(); uniqIdGenerator = Guid.NewGuid();
string test = uniqIdGenerator.ToString(); string test = uniqIdGenerator.ToString();
Layers.Add(new Sketch(String.Concat("Layer", Layers.Count + 1), CanvasSize, newTools, uniqIdGenerator.ToString())); Sketch newSketch = new Sketch(String.Concat("Layer_", Layers.Count + 1), CanvasSize, newTools, uniqIdGenerator.ToString());
Layers.Add(newSketch);
LayersToPrint.Add(newSketch.Id);
RestoreLayerNames();
return (newSketch.Id);
}
private void RestoreLayerNames()
{
//resets all the names to not have multiple layer 3 for example
for (int i = 0; i < Layers.Count; i++)
{
Layers[i].Name = "Layer_" + (i + 1);
}
} }
public bool RemoveLayer(string layerId) public bool RemoveLayer(string layerId)
{ {
@@ -71,6 +86,7 @@ namespace Paint_2
if (layer != null) if (layer != null)
{ {
Layers.Remove(layer); Layers.Remove(layer);
RestoreLayerNames();
return true; return true;
} }
else else