diff --git a/Greenshot/Forms/ImageEditorForm.cs b/Greenshot/Forms/ImageEditorForm.cs
index 276a4a5e8..2d52723b5 100644
--- a/Greenshot/Forms/ImageEditorForm.cs
+++ b/Greenshot/Forms/ImageEditorForm.cs
@@ -354,7 +354,7 @@ namespace Greenshot {
this.Size = new Size(newWidth, newHeight);
}
dimensionsLabel.Text = this.Surface.Image.Width + "x" + this.Surface.Image.Height;
- ImageEditorFormResize(source,new EventArgs());
+ ImageEditorFormResize(source, new EventArgs());
}
private void ReloadConfiguration(object source, FileSystemEventArgs e) {
@@ -1266,17 +1266,24 @@ namespace Greenshot {
}
Size imageSize = this.Surface.Image.Size;
Size currentImageClientSize = this.panel1.ClientSize;
+ var canvas = this.Surface as Control;
if (currentImageClientSize.Width > imageSize.Width) {
- var canvas = this.Surface as Control;
if (canvas != null) {
canvas.Left = (currentImageClientSize.Width - imageSize.Width) / 2;
}
+ } else {
+ if (canvas != null) {
+ canvas.Left = 0;
+ }
}
if (currentImageClientSize.Height > imageSize.Height) {
- var canvas = this.Surface as Control;
if (canvas != null) {
canvas.Top = (currentImageClientSize.Height - imageSize.Height) / 2;
}
+ } else {
+ if (canvas != null) {
+ canvas.Top = 0;
+ }
}
}
}
diff --git a/Greenshot/Forms/ResizeSettingsForm.cs b/Greenshot/Forms/ResizeSettingsForm.cs
index 9f5fb3620..b353bc9ac 100644
--- a/Greenshot/Forms/ResizeSettingsForm.cs
+++ b/Greenshot/Forms/ResizeSettingsForm.cs
@@ -54,21 +54,7 @@ namespace Greenshot.Forms {
checkbox_aspectratio.Checked = effect.MaintainAspectRatio;
}
- private void checkValues() {
- if (value_pixel.Equals(combobox_width.SelectedItem)) {
- newWidth = int.Parse(textbox_width.Text);
- } else {
- newWidth = (int)(effect.Width * (100f / double.Parse(textbox_width.Text)));
- }
- if (value_pixel.Equals(combobox_height.SelectedItem)) {
- newHeight = int.Parse(textbox_height.Text);
- } else {
- newHeight = (int)(effect.Height * (100f / double.Parse(textbox_height.Text)));
- }
- }
-
private void buttonOK_Click(object sender, EventArgs e) {
- checkValues();
if (newWidth != effect.Width || newHeight != effect.Height) {
effect.Width = newWidth;
effect.Height = newHeight;
@@ -111,7 +97,9 @@ namespace Greenshot.Forms {
}
private void textbox_KeyUp(object sender, KeyEventArgs e) {
- validate(sender);
+ if (!validate(sender)) {
+ return;
+ }
if (!checkbox_aspectratio.Checked) {
return;
}
@@ -164,8 +152,12 @@ namespace Greenshot.Forms {
///
///
private void combobox_SelectedIndexChanged(object sender, EventArgs e) {
- displayWidth();
- displayHeight();
+ if (validate(textbox_width)) {
+ displayWidth();
+ }
+ if (validate(textbox_height)) {
+ displayHeight();
+ }
}
}
}