Browse Source

Designer positioning fixes

pull/346/head
Nikita Tsukanov 10 years ago
parent
commit
2e7f3091c8
  1. 6
      src/Windows/Perspex.Designer/AppHost/WindowHost.cs
  2. 14
      src/Windows/Perspex.Designer/PerspexDesigner.xaml.cs

6
src/Windows/Perspex.Designer/AppHost/WindowHost.cs

@ -25,6 +25,8 @@ namespace Perspex.Designer.AppHost
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
Controls.Add(_windowHost);
_windowHost.Anchor = AnchorStyles.None;
if (!supportScroll)
_windowHost.Visible = false;
_timer.Tick += delegate
{
ReloadSettings();
@ -98,7 +100,7 @@ namespace Perspex.Designer.AppHost
_hWnd = hWnd;
if (_hWnd != IntPtr.Zero)
{
WinApi.SetParent(hWnd, _windowHost.Handle);
WinApi.SetParent(hWnd, _supportScroll ? _windowHost.Handle : Handle);
FixWindow();
}
}
@ -127,8 +129,6 @@ namespace Perspex.Designer.AppHost
}
else
{
_windowHost.Width = Width;
_windowHost.Height = Height;
WinApi.MoveWindow(_hWnd, 0, 0, Width, Height, true);
}
}

14
src/Windows/Perspex.Designer/PerspexDesigner.xaml.cs

@ -73,14 +73,16 @@ namespace Perspex.Designer
{
if (e.PropertyName == nameof(ProcessHost.WindowHandle))
{
if (NativeContainer.Child == null)
if (NativeContainer.Child != null)
{
NativeContainer.Child = new WindowHost(false);
}
{
var wndHost = ((WindowHost) NativeContainer.Child);
wndHost.SetWindow(_host.WindowHandle);
var child = NativeContainer.Child;
NativeContainer.Child = null;
child.Dispose();
}
NativeContainer.Child = new WindowHost(false);
var wndHost = ((WindowHost) NativeContainer.Child);
wndHost.SetWindow(_host.WindowHandle);
}
}

Loading…
Cancel
Save