update workshop 2 for resizing

This commit is contained in:
2024-02-02 11:53:06 +00:00
parent 65deb2f082
commit c3d33a227a
3 changed files with 62 additions and 37 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

View File

@@ -32,53 +32,36 @@ namespace workshop2
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.button3 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.controlPanel = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
this.controlPanel.SuspendLayout();
this.SuspendLayout();
//
// pictureBox1
//
this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(12, 12);
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(300, 300);
this.pictureBox1.Size = new System.Drawing.Size(334, 321);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(328, 24);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 40);
this.button1.TabIndex = 1;
this.button1.Text = "Select Image";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.openFileButton_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(328, 86);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 40);
this.button2.TabIndex = 2;
this.button2.Text = "Quit";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.quitButton_Click);
//
// openFileDialog1
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// button3
//
this.button3.Location = new System.Drawing.Point(328, 162);
this.button3.Location = new System.Drawing.Point(26, 85);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(40, 40);
this.button3.TabIndex = 3;
@@ -86,9 +69,19 @@ namespace workshop2
this.button3.UseVisualStyleBackColor = true;
this.button3.Click += new System.EventHandler(this.rotateLeft_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(26, 227);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 40);
this.button2.TabIndex = 2;
this.button2.Text = "Quit";
this.button2.UseVisualStyleBackColor = true;
this.button2.Click += new System.EventHandler(this.quitButton_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(388, 162);
this.button4.Location = new System.Drawing.Point(86, 85);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(40, 40);
this.button4.TabIndex = 4;
@@ -96,43 +89,65 @@ namespace workshop2
this.button4.UseVisualStyleBackColor = true;
this.button4.Click += new System.EventHandler(this.rotateRight_Click);
//
// button1
//
this.button1.Location = new System.Drawing.Point(26, 19);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 40);
this.button1.TabIndex = 1;
this.button1.Text = "Select Image";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.openFileButton_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(357, 146);
this.label1.Location = new System.Drawing.Point(55, 69);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(39, 13);
this.label1.TabIndex = 5;
this.label1.Text = "Rotate";
//
// controlPanel
//
this.controlPanel.Controls.Add(this.label1);
this.controlPanel.Controls.Add(this.button1);
this.controlPanel.Controls.Add(this.button4);
this.controlPanel.Controls.Add(this.button2);
this.controlPanel.Controls.Add(this.button3);
this.controlPanel.Dock = System.Windows.Forms.DockStyle.Right;
this.controlPanel.Location = new System.Drawing.Point(334, 0);
this.controlPanel.Name = "controlPanel";
this.controlPanel.Size = new System.Drawing.Size(150, 321);
this.controlPanel.TabIndex = 6;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(449, 322);
this.Controls.Add(this.label1);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.ClientSize = new System.Drawing.Size(484, 321);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.controlPanel);
this.Name = "Form1";
this.Text = "Form1";
this.Text = "Workshop 2 Basic";
this.Load += new System.EventHandler(this.Form1_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
this.controlPanel.ResumeLayout(false);
this.controlPanel.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.PictureBox pictureBox1;
private Button button1;
private Button button2;
private OpenFileDialog openFileDialog1;
private Button button3;
private Button button2;
private Button button4;
private Button button1;
private Label label1;
private Panel controlPanel;
}
}

View File

@@ -26,6 +26,8 @@ namespace workshop2
{
openFileDialog1.ShowDialog();
pictureBox1.Load(openFileDialog1.FileName);
//pictureBox1.Size = pictureBox1.Image.Size;
pictureBox1.SizeMode = AutoSize(true);
}
private void quitButton_Click(object sender, EventArgs e)
@@ -49,5 +51,13 @@ namespace workshop2
pictureBox1.Image = image;
pictureBox1.Refresh();
}
private void Form1_Load(object sender, EventArgs e)
{
this.MinimumSize = new System.Drawing.Size(this.Width, this.Height);
this.MaximumSize = new System.Drawing.Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
this.AutoSize = true;
this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
}
}
}