Added reset button to thumbnail size form

This commit is contained in:
Jaex 2020-12-11 15:06:01 +03:00
parent d73083c106
commit 7097c13369
2 changed files with 24 additions and 5 deletions

View file

@ -35,6 +35,7 @@ private void InitializeComponent()
this.nudHeight = new System.Windows.Forms.NumericUpDown();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.btnReset = new System.Windows.Forms.Button();
((System.ComponentModel.ISupportInitialize)(this.nudWidth)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudHeight)).BeginInit();
this.SuspendLayout();
@ -105,10 +106,10 @@ private void InitializeComponent()
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(16, 72);
this.btnOK.Location = new System.Drawing.Point(16, 96);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(96, 24);
this.btnOK.TabIndex = 4;
this.btnOK.TabIndex = 5;
this.btnOK.Text = "OK";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
@ -116,21 +117,32 @@ private void InitializeComponent()
// btnCancel
//
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(120, 72);
this.btnCancel.Location = new System.Drawing.Point(120, 96);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(96, 24);
this.btnCancel.TabIndex = 5;
this.btnCancel.TabIndex = 6;
this.btnCancel.Text = "Cancel";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// btnReset
//
this.btnReset.Location = new System.Drawing.Point(120, 64);
this.btnReset.Name = "btnReset";
this.btnReset.Size = new System.Drawing.Size(96, 24);
this.btnReset.TabIndex = 4;
this.btnReset.Text = "Reset";
this.btnReset.UseVisualStyleBackColor = true;
this.btnReset.Click += new System.EventHandler(this.btnReset_Click);
//
// ThumbnailSizeForm
//
this.AcceptButton = this.btnOK;
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(229, 107);
this.ClientSize = new System.Drawing.Size(229, 130);
this.Controls.Add(this.btnReset);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.nudHeight);
@ -158,5 +170,6 @@ private void InitializeComponent()
private System.Windows.Forms.NumericUpDown nudHeight;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.Button btnReset;
}
}

View file

@ -47,6 +47,12 @@ public ThumbnailSizeForm(Size thumbnailSize) : this()
nudHeight.SetValue(ThumbnailSize.Height);
}
private void btnReset_Click(object sender, EventArgs e)
{
nudWidth.SetValue(200);
nudHeight.SetValue(150);
}
private void btnOK_Click(object sender, EventArgs e)
{
ThumbnailSize = new Size((int)nudWidth.Value, (int)nudHeight.Value);