mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
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:
parent
8be44214ce
commit
6f633dbeb2
2 changed files with 19 additions and 20 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue