public void Close() { if (_host != null) { _host.RemoveView(this); Dispose(); } }
/// <summary>Raises the <see cref="E:System.Windows.Forms.Control.MouseMove"/> event.</summary> /// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs"/> that contains the event data.</param> protected override void OnMouseMove(MouseEventArgs e) { if (_readyToFloat) { if (Math.Abs(_mdX - e.X) >= ViewConstants.ViewFloatDragMargin || Math.Abs(_mdY - e.Y) >= ViewConstants.ViewFloatDragMargin) { var form = _viewHost.GetRootOwnerForm(); _readyToFloat = false; var tab = _tabs[_floatId]; _viewHost.RemoveView(tab.View); var host = new ViewHost(_viewHost.Grid, false, false, new[] { tab.View }); var floatingForm = host.PrepareFloatingMode(); Capture = false; _viewHost.Focus(); floatingForm.Show(form); floatingForm.Shown += (sender, args) => ((ViewHost)((Form)sender).Controls[0]).StartMoving(e.X, e.Y); _floatId = -1; } } int areaId = _areaMouseDown; int tabId; int offset; if (areaId == -1) { areaId = HitTestArea(e.X, e.Y); } if (areaId == -1) { _areaHover.Drop(); } else { _areaHover.Track(areaId, null); } if (areaId == -1) { _areaHover.Drop(); tabId = -1; offset = 0; } else { if (_floatId == -1) { if (areaId == 1) { Rectangle bounds; tabId = HitTestTab(e.X, e.Y, out bounds); if (tabId == -1) { _tabHover.Drop(); } offset = bounds.X; } else { tabId = -1; offset = 0; } } else { areaId = 1; tabId = _floatId; offset = GetTabOffset(_floatId); } } switch (areaId) { case 0: _leftButtons.OnMouseMove(e.X, e.Y, e.Button); break; case 1: if (tabId != -1) { _tabHover.Track(tabId, _tabs[tabId]); int x = e.X; int y = e.Y; switch (_side) { case AnchorStyles.Top: case AnchorStyles.Bottom: x -= offset; break; case AnchorStyles.Left: case AnchorStyles.Right: y -= offset; break; } _tabs[tabId].OnMouseMove(x, y, e.Button); } break; case 2: _rightButtons.OnMouseMove(e.X - (Width - _rightButtons.Width), e.Y, e.Button); break; } base.OnMouseMove(e); }