public static CommandResult Test(ICommandTarget target) { IPoderosaMainWindow window = CommandTargetUtil.AsWindow(target); ISplittableViewManager sp = (ISplittableViewManager)window.ViewManager.GetAdapter(typeof(ISplittableViewManager)); sp.ApplySplitInfo("V(33:Lterminal,33:Lterminal,L:Lterminal)"); return(CommandResult.Succeeded); }
public void ApplyToLoadedWindow(MainWindow f) { //DesktopBoundsの設定はOnLoadの中じゃないといかんらしい f.DesktopBounds = _location; f.WindowState = _windowState; //頑張ればOnLoad以前にSplitInfoを適用できるかも if (_splitInfo.Length > 0) { ISplittableViewManager vm = (ISplittableViewManager)f.ViewManager.GetAdapter(typeof(ISplittableViewManager)); if (vm != null) { vm.ApplySplitInfo(_splitInfo); } } //ToolBarのコンポーネント位置調整 f.ToolBarInternal.RestoreLayout(); }
public void ApplyToLoadedWindow(MainWindow f) { const int MARGIN = 3; Rectangle titlebarRect = new Rectangle(_location.X + MARGIN, _location.Y + MARGIN, Math.Max(_location.Width - MARGIN * 2, 1), Math.Max(SystemInformation.CaptionHeight - MARGIN * 2, 1)); bool visible = false; foreach (Screen s in Screen.AllScreens) { if (s.WorkingArea.IntersectsWith(titlebarRect)) { visible = true; } } if (!visible) { Screen baseScreen = null; foreach (Screen s in Screen.AllScreens) { if (s.Bounds.IntersectsWith(_location)) { baseScreen = s; break; } } if (baseScreen == null) { baseScreen = Screen.PrimaryScreen; } Rectangle sb = baseScreen.WorkingArea; if (_location.Width > sb.Width) { _location.Width = sb.Width; } if (_location.Height > sb.Height) { _location.Height = sb.Height; } _location.X = sb.X + (sb.Width - _location.Width) / 2; _location.Y = sb.Y + (sb.Height - _location.Height) / 2; } //DesktopBoundsの設定はOnLoadの中じゃないといかんらしい f.DesktopBounds = _location; f.WindowState = _windowState; //頑張ればOnLoad以前にSplitInfoを適用できるかも if (_splitInfo.Length > 0) { ISplittableViewManager vm = (ISplittableViewManager)f.ViewManager.GetAdapter(typeof(ISplittableViewManager)); if (vm != null) { vm.ApplySplitInfo(_splitInfo); } } //ToolBarのコンポーネント位置調整 f.ToolBarInternal.RestoreLayout(); }