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

@ -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;
}
}
}
}