public void AddModal(WindowHost host) { currentModalChild = host; CursorType = CursorType.Default; EnableManipulation = false; AddChild(host); }
private void CurrentChild_Disposed(object sender, EventArgs e) { currentChild.Disposed -= CurrentChild_Disposed; currentChild.LocationChanged -= CurrentChild_LocationChanged; RemoveOwnedForm(currentChild); currentChild = null; currentModalChild = null; EnableManipulation = true; }
public void AddChild(WindowHost host) { currentChild = host; currentChild.Disposed += CurrentChild_Disposed; currentChild.LocationChanged += CurrentChild_LocationChanged; host.StartPosition = FormStartPosition.Manual; var offset = PointToScreen(Point.Empty); offset.X -= Location.X; offset.Y -= Location.Y; offset.X += (ClientSize.Width - currentChild.Size.Width) / 2; offset.Y += (ClientSize.Height - currentChild.Size.Height) / 2; childRelativePosition = offset; AddOwnedForm(host); OnLocationChanged(this, EventArgs.Empty); }