Fixed resize bug in Editor and ResizeSettingsForm

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2382 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-12-12 16:24:09 +00:00
commit 6f633dbeb2
2 changed files with 19 additions and 20 deletions

View file

@ -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 {
/// <param name="sender"></param>
/// <param name="e"></param>
private void combobox_SelectedIndexChanged(object sender, EventArgs e) {
displayWidth();
displayHeight();
if (validate(textbox_width)) {
displayWidth();
}
if (validate(textbox_height)) {
displayHeight();
}
}
}
}