Added a little preview of the width and color next to the width selector

This commit is contained in:
2022-06-08 14:26:23 +02:00
parent 0f8cc294e3
commit d1d1b4936e
2 changed files with 34 additions and 23 deletions

View File

@@ -55,7 +55,7 @@
this.btnColorHistory1 = new System.Windows.Forms.Button(); this.btnColorHistory1 = new System.Windows.Forms.Button();
this.btnClear = new System.Windows.Forms.Button(); this.btnClear = new System.Windows.Forms.Button();
this.panelTools = new System.Windows.Forms.Panel(); this.panelTools = new System.Windows.Forms.Panel();
this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.pbxSample = new System.Windows.Forms.PictureBox();
this.btnRandomColor = new System.Windows.Forms.Button(); this.btnRandomColor = new System.Windows.Forms.Button();
this.btnColorPicker = new System.Windows.Forms.Button(); this.btnColorPicker = new System.Windows.Forms.Button();
this.btnRedo = new System.Windows.Forms.Button(); this.btnRedo = new System.Windows.Forms.Button();
@@ -77,7 +77,7 @@
this.panelHoverColor.SuspendLayout(); this.panelHoverColor.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nupPencilWidth)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nupPencilWidth)).BeginInit();
this.panelTools.SuspendLayout(); this.panelTools.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pbxSample)).BeginInit();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.panel2.SuspendLayout(); this.panel2.SuspendLayout();
this.panel3.SuspendLayout(); this.panel3.SuspendLayout();
@@ -89,7 +89,7 @@
this.tbxProjectName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tbxProjectName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.tbxProjectName.Font = new System.Drawing.Font("Verdana", 15F); this.tbxProjectName.Font = new System.Drawing.Font("Verdana", 15F);
this.tbxProjectName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.tbxProjectName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.tbxProjectName.Location = new System.Drawing.Point(11, 5); this.tbxProjectName.Location = new System.Drawing.Point(11, 3);
this.tbxProjectName.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.tbxProjectName.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.tbxProjectName.Name = "tbxProjectName"; this.tbxProjectName.Name = "tbxProjectName";
this.tbxProjectName.Size = new System.Drawing.Size(253, 38); this.tbxProjectName.Size = new System.Drawing.Size(253, 38);
@@ -101,7 +101,7 @@
this.btnSave.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.btnSave.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnSave.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnSave.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.btnSave.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnSave.Location = new System.Drawing.Point(315, 166); this.btnSave.Location = new System.Drawing.Point(268, 3);
this.btnSave.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.btnSave.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.btnSave.Name = "btnSave"; this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(82, 39); this.btnSave.Size = new System.Drawing.Size(82, 39);
@@ -114,7 +114,7 @@
// //
this.canvas.BackColor = System.Drawing.Color.Transparent; this.canvas.BackColor = System.Drawing.Color.Transparent;
this.canvas.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.canvas.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.canvas.Location = new System.Drawing.Point(11, 67); this.canvas.Location = new System.Drawing.Point(11, 59);
this.canvas.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.canvas.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.canvas.Name = "canvas"; this.canvas.Name = "canvas";
this.canvas.Size = new System.Drawing.Size(900, 500); this.canvas.Size = new System.Drawing.Size(900, 500);
@@ -128,7 +128,7 @@
this.btnSaveCopy.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.btnSaveCopy.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.btnSaveCopy.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnSaveCopy.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnSaveCopy.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.btnSaveCopy.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnSaveCopy.Location = new System.Drawing.Point(401, 166); this.btnSaveCopy.Location = new System.Drawing.Point(354, 3);
this.btnSaveCopy.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.btnSaveCopy.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.btnSaveCopy.Name = "btnSaveCopy"; this.btnSaveCopy.Name = "btnSaveCopy";
this.btnSaveCopy.Size = new System.Drawing.Size(135, 39); this.btnSaveCopy.Size = new System.Drawing.Size(135, 39);
@@ -151,10 +151,13 @@
// //
this.panelFile.BackColor = System.Drawing.Color.Transparent; this.panelFile.BackColor = System.Drawing.Color.Transparent;
this.panelFile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panelFile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelFile.Controls.Add(this.btnLoadFile);
this.panelFile.Controls.Add(this.tbxProjectName); this.panelFile.Controls.Add(this.tbxProjectName);
this.panelFile.Controls.Add(this.btnSave);
this.panelFile.Controls.Add(this.btnSaveCopy);
this.panelFile.Location = new System.Drawing.Point(12, 6); this.panelFile.Location = new System.Drawing.Point(12, 6);
this.panelFile.Name = "panelFile"; this.panelFile.Name = "panelFile";
this.panelFile.Size = new System.Drawing.Size(644, 55); this.panelFile.Size = new System.Drawing.Size(644, 47);
this.panelFile.TabIndex = 8; this.panelFile.TabIndex = 8;
// //
// btnLoadFile // btnLoadFile
@@ -162,7 +165,7 @@
this.btnLoadFile.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59))))); this.btnLoadFile.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(59)))), ((int)(((byte)(59)))), ((int)(((byte)(59)))));
this.btnLoadFile.FlatStyle = System.Windows.Forms.FlatStyle.Popup; this.btnLoadFile.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
this.btnLoadFile.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247))))); this.btnLoadFile.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(247)))), ((int)(((byte)(247)))), ((int)(((byte)(247)))));
this.btnLoadFile.Location = new System.Drawing.Point(540, 166); this.btnLoadFile.Location = new System.Drawing.Point(493, 3);
this.btnLoadFile.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3); this.btnLoadFile.Margin = new System.Windows.Forms.Padding(2, 3, 2, 3);
this.btnLoadFile.Name = "btnLoadFile"; this.btnLoadFile.Name = "btnLoadFile";
this.btnLoadFile.Size = new System.Drawing.Size(143, 39); this.btnLoadFile.Size = new System.Drawing.Size(143, 39);
@@ -392,7 +395,7 @@
this.panelTools.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.panelTools.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.panelTools.BackColor = System.Drawing.Color.Transparent; this.panelTools.BackColor = System.Drawing.Color.Transparent;
this.panelTools.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.panelTools.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panelTools.Controls.Add(this.pictureBox1); this.panelTools.Controls.Add(this.pbxSample);
this.panelTools.Controls.Add(this.btnRandomColor); this.panelTools.Controls.Add(this.btnRandomColor);
this.panelTools.Controls.Add(this.btnColorPicker); this.panelTools.Controls.Add(this.btnColorPicker);
this.panelTools.Controls.Add(this.btnColorHistory1); this.panelTools.Controls.Add(this.btnColorHistory1);
@@ -403,16 +406,16 @@
this.panelTools.Controls.Add(this.nupPencilWidth); this.panelTools.Controls.Add(this.nupPencilWidth);
this.panelTools.Location = new System.Drawing.Point(920, 6); this.panelTools.Location = new System.Drawing.Point(920, 6);
this.panelTools.Name = "panelTools"; this.panelTools.Name = "panelTools";
this.panelTools.Size = new System.Drawing.Size(200, 199); this.panelTools.Size = new System.Drawing.Size(200, 193);
this.panelTools.TabIndex = 31; this.panelTools.TabIndex = 31;
// //
// pictureBox1 // pbxSample
// //
this.pictureBox1.Location = new System.Drawing.Point(10, 152); this.pbxSample.Location = new System.Drawing.Point(10, 152);
this.pictureBox1.Name = "pictureBox1"; this.pbxSample.Name = "pbxSample";
this.pictureBox1.Size = new System.Drawing.Size(101, 33); this.pbxSample.Size = new System.Drawing.Size(101, 33);
this.pictureBox1.TabIndex = 35; this.pbxSample.TabIndex = 35;
this.pictureBox1.TabStop = false; this.pbxSample.TabStop = false;
// //
// btnRandomColor // btnRandomColor
// //
@@ -504,7 +507,7 @@
this.panel2.Controls.Add(this.label1); this.panel2.Controls.Add(this.label1);
this.panel2.Controls.Add(this.button2); this.panel2.Controls.Add(this.button2);
this.panel2.Controls.Add(this.lsbTools); this.panel2.Controls.Add(this.lsbTools);
this.panel2.Location = new System.Drawing.Point(920, 211); this.panel2.Location = new System.Drawing.Point(920, 205);
this.panel2.Name = "panel2"; this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(200, 175); this.panel2.Size = new System.Drawing.Size(200, 175);
this.panel2.TabIndex = 36; this.panel2.TabIndex = 36;
@@ -543,7 +546,7 @@
this.panel3.Controls.Add(this.label2); this.panel3.Controls.Add(this.label2);
this.panel3.Controls.Add(this.button1); this.panel3.Controls.Add(this.button1);
this.panel3.Controls.Add(this.listBox1); this.panel3.Controls.Add(this.listBox1);
this.panel3.Location = new System.Drawing.Point(920, 392); this.panel3.Location = new System.Drawing.Point(920, 384);
this.panel3.Name = "panel3"; this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(200, 175); this.panel3.Size = new System.Drawing.Size(200, 175);
this.panel3.TabIndex = 37; this.panel3.TabIndex = 37;
@@ -600,11 +603,8 @@
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(1132, 655); this.ClientSize = new System.Drawing.Size(1132, 655);
this.Controls.Add(this.btnLoadFile);
this.Controls.Add(this.panel3); this.Controls.Add(this.panel3);
this.Controls.Add(this.btnSaveCopy);
this.Controls.Add(this.panel2); this.Controls.Add(this.panel2);
this.Controls.Add(this.btnSave);
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Controls.Add(this.panelHoverColor); this.Controls.Add(this.panelHoverColor);
this.Controls.Add(this.panelSelectedColor); this.Controls.Add(this.panelSelectedColor);
@@ -632,7 +632,7 @@
((System.ComponentModel.ISupportInitialize)(this.nupPencilWidth)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.nupPencilWidth)).EndInit();
this.panelTools.ResumeLayout(false); this.panelTools.ResumeLayout(false);
this.panelTools.PerformLayout(); this.panelTools.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.pbxSample)).EndInit();
this.panel1.ResumeLayout(false); this.panel1.ResumeLayout(false);
this.panel2.ResumeLayout(false); this.panel2.ResumeLayout(false);
this.panel2.PerformLayout(); this.panel2.PerformLayout();
@@ -674,7 +674,7 @@
private System.Windows.Forms.Button btnUndo; private System.Windows.Forms.Button btnUndo;
private System.Windows.Forms.Button btnRedo; private System.Windows.Forms.Button btnRedo;
private System.Windows.Forms.Button btnColorPicker; private System.Windows.Forms.Button btnColorPicker;
private System.Windows.Forms.PictureBox pictureBox1; private System.Windows.Forms.PictureBox pbxSample;
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Panel panel2; private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label1;

View File

@@ -117,6 +117,8 @@ namespace Paint_2
lblWidth.Text = "W: " + canvas.Width.ToString(); lblWidth.Text = "W: " + canvas.Width.ToString();
lblHeight.Text = "H: " + canvas.Height.ToString(); lblHeight.Text = "H: " + canvas.Height.ToString();
pbxSample.Image = DrawSample(pbxSample.Size);
if (randomColor) if (randomColor)
{ {
btnRandomColor.BackColor = FLAT_GREEN; btnRandomColor.BackColor = FLAT_GREEN;
@@ -126,6 +128,15 @@ namespace Paint_2
btnRandomColor.BackColor = FLAT_RED; btnRandomColor.BackColor = FLAT_RED;
} }
} }
private Bitmap DrawSample(Size size)
{
Bitmap map = new Bitmap(size.Width,size.Height);
Graphics gr = Graphics.FromImage(map);
gr.DrawLine(new Pen(sketch.CurrentTool.Color,sketch.CurrentTool.Width),new Point(0,0),new Point(size.Width,size.Height));
return map;
}
private Color GetHoverColor() private Color GetHoverColor()
{ {
Point cursorLocation = MousePositionToCanvasPosition(); Point cursorLocation = MousePositionToCanvasPosition();