Browse Source

fix SD-1859 - Crash when opening Goto Dialog

4.1
Siegfried Pammer 15 years ago
parent
commit
38708b351b
  1. 14
      src/Main/Base/Project/Src/Gui/FormLocationHelper.cs

14
src/Main/Base/Project/Src/Gui/FormLocationHelper.cs

@ -41,7 +41,10 @@ namespace ICSharpCode.SharpDevelop.Gui
if (isResizable) { if (isResizable) {
Rect bounds = PropertyService.Get(propertyName, GetDefaultBounds(window)); Rect bounds = PropertyService.Get(propertyName, GetDefaultBounds(window));
bounds.Offset(ownerLocation.X, ownerLocation.Y); bounds.Offset(ownerLocation.X, ownerLocation.Y);
bounds = Validate(bounds.TransformToDevice(window).ToSystemDrawing()).ToWpf().TransformFromDevice(window); window.SourceInitialized += delegate {
bounds = Validate(bounds.TransformToDevice(window).ToSystemDrawing())
.ToWpf().TransformFromDevice(window);
};
window.Left = bounds.X; window.Left = bounds.X;
window.Top = bounds.Y; window.Top = bounds.Y;
window.Width = bounds.Width; window.Width = bounds.Width;
@ -50,9 +53,12 @@ namespace ICSharpCode.SharpDevelop.Gui
Size size = new Size(window.ActualWidth, window.ActualHeight); Size size = new Size(window.ActualWidth, window.ActualHeight);
Point location = PropertyService.Get(propertyName, GetDefaultLocation(window)); Point location = PropertyService.Get(propertyName, GetDefaultLocation(window));
location.Offset(ownerLocation.X, ownerLocation.Y); location.Offset(ownerLocation.X, ownerLocation.Y);
var bounds = Validate(new Rect(location, size).TransformToDevice(window).ToSystemDrawing()).ToWpf().TransformFromDevice(window); window.SourceInitialized += delegate {
window.Left = bounds.X; var bounds = Validate(new Rect(location, size).TransformToDevice(window).ToSystemDrawing())
window.Top = bounds.Y; .ToWpf().TransformFromDevice(window);
window.Left = bounds.X;
window.Top = bounds.Y;
};
} }
window.Closing += delegate { window.Closing += delegate {
var relativeToOwner = GetLocationRelativeToOwner(window); var relativeToOwner = GetLocationRelativeToOwner(window);

Loading…
Cancel
Save