private IEnumerator BuildDock(Island islandComponent, DockType dockType) { var islandStructure = islandComponent.CartographicIsland; var dockPrefabs = VisualizationLoader.Instance.DockPrefabs; GameObject dock = Instantiate(dockPrefabs[dockType], Vector3.zero, Quaternion.identity); dock.transform.parent = islandStructure.IslandGameObject.transform; float[] heightProfile = IslandStructureBuilder.HEIGHT_PROFILE; Vector3 dockDirection = new Vector3(UnityEngine.Random.value, 0, UnityEngine.Random.value); dockDirection.Normalize(); dockDirection *= islandStructure.Radius; Vector3 dockPos = islandStructure.WeightedCenter + dockDirection; dockPos.y -= 2.0f; dock.transform.localPosition = dockPos; dock.name = islandStructure.Name + " " + Enum.GetName(typeof(DockType), dockType); dock.transform.localScale = Vector3.one; if (dockType == DockType.Import) { islandComponent.ImportDock = dock; } else { islandComponent.ExportDock = dock; } yield return(null); }
void Awake() { connectionArrows = new List <GameObject>(); connectedDocks = new List <DependencyDock>(); dockWeights = new List <float>(); dependencyContainer = UIManager.Instance.DependencyContainer; expanded = false; dockType = DockType.Import; importArrowPrefab = (GameObject)Resources.Load("Prefabs/ImportArrow"); exportArrowPrefab = (GameObject)Resources.Load("Prefabs/ExportArrow"); arrowHeadPrefab = (GameObject)Resources.Load("Prefabs/ArrowHead"); rotPivot = new GameObject("Rotation Pivot"); rotPivot.transform.position = transform.position; rotPivot.transform.SetParent(transform); ConnectionPool[] pools = FindObjectsOfType(typeof(ConnectionPool)) as ConnectionPool[]; if (pools.Length == 1) { connectionPool = pools[0]; } else { throw new Exception("No connection pool component found, or too many connection pools! There can only be one."); } }
public static void Dock(this EditorWindow self, EditorWindow child, DockType type) { var anchorParent = GetParentOf(self); SetDragSource(anchorParent, GetParentOf(child)); PerformDrop(GetWindowOf(anchorParent), child, GetFakeMousePosition(self, type)); }
public bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e) { if (managerType == typeof(StateChangedEventManager)) { DockableContent conent = sender as DockableContent; if (conent != null) { DockType type = Type; switch (conent.State) { case DockableContentState.FloatingWindow: type = DockType.Floating; break; case DockableContentState.Document: type = DockType.Document; break; default: type = DockType.DockableContent; break; } Type = type; } return true; } return false; }
private static void ChangeDocking(DockedMetroWindow dockWindow, DockType oldValue, DockType newValue) { if (dockWindow != null && dockWindow.IsDocked) { SetDocking(dockWindow, newValue); } }
public Resize(DockType dock, Vector2 size, Vector2 margin) { this.docktype = dock; this.size = size; this.margin = margin; this.mode = ResizeMode.Dock; }
private void SetDockType(DockType Dock) { switch (Dock) { case DockType.None: { toolStripDockNone.Checked = true; toolStripDockLeft.Checked = false; toolStripDockTop.Checked = false; toolStripDockRight.Checked = false; toolStripDockBottom.Checked = false; } break; case DockType.Left: { toolStripDockNone.Checked = false; toolStripDockLeft.Checked = true; toolStripDockTop.Checked = false; toolStripDockRight.Checked = false; toolStripDockBottom.Checked = false; } break; case DockType.Top: { toolStripDockNone.Checked = false; toolStripDockLeft.Checked = false; toolStripDockTop.Checked = true; toolStripDockRight.Checked = false; toolStripDockBottom.Checked = false; } break; case DockType.Right: { toolStripDockNone.Checked = false; toolStripDockLeft.Checked = false; toolStripDockTop.Checked = false; toolStripDockRight.Checked = true; toolStripDockBottom.Checked = false; } break; case DockType.Bottom: { toolStripDockNone.Checked = false; toolStripDockLeft.Checked = false; toolStripDockTop.Checked = false; toolStripDockRight.Checked = false; toolStripDockBottom.Checked = true; } break; } this.dock = Dock; lastPosition = Win32Interop.Rect.Zero(); }
public DockPage Put(Widget widget, DockType type) { DockPage page = PickPage(widget); if (page != null) { page.Panel.DockItem.Visible = true; if (page.Visible) { page.Panel.CurrentPage = page; } else { page.Visible = true; } } else { widget.GotFocus += ChildFocusInEvent; DockItem item = null; if (type == DockType.Content) { item = Main; } else if (type == DockType.Left) { item = GetDockItem("Left", Main, LayoutAlignType.Left, false); } else if (type == DockType.LeftBottom) { item = GetDockItem("Left", Main, LayoutAlignType.Left, false); item = GetDockItem("LeftBottom", item, LayoutAlignType.Bottom, true); } else if (type == DockType.Right) { item = GetDockItem("Right", Main, LayoutAlignType.Right, false); } else if (type == DockType.RightBottom) { item = GetDockItem("Right", Main, LayoutAlignType.Right, false); item = GetDockItem("RightBottom", item, LayoutAlignType.Bottom, true); } else if (type == DockType.Top) { item = GetDockItem("Top", Main, LayoutAlignType.Top, false); } else if (type == DockType.Bottom) { item = GetDockItem("Bottom", Main, LayoutAlignType.Bottom, false); //item.Panel.PagesAlign = LayoutAlignType.Bottom; } item.Visible = true; page = item.Panel.Put(widget); } QueueForReallocate(); return(page); }
public DrivingPicker(Rectangle location, DockType dockType, CompressedBuilding compressedBuilding, EditorParams editorParams) : base(location, dockType, true) { this.compressedBuilding = compressedBuilding; this.editorParams = editorParams; drawSpriteBack = true; spriteBack = GraphicsManager.GetPreBuilt(Engine.ContentStorage.PrebuiltSprite.EditorPanelBackGrey); AddBorder(3, Resizing.NONE, 1); AddHeading(40, "Driving Picker", GraphicsManager.GetSpriteFont(Font.OpenSans18), Color.White, false, false, false, false, true, GraphicsManager.GetSpriteColour(6)); }
public DockPage Put(Widget widget, DockType type) { var page = new DockPage { Name = widget.Name, Widget = widget, }; Put(page); return(page); }
public IImageElement XCreateElement(ITexture tex, int x, int y, DockType dock, Color color, RectI subregion) { global::System.IntPtr cPtr = IronSightEnginePINVOKE.IHUD_XCreateElement__SWIG_3(swigCPtr, ITexture.getCPtr(tex), x, y, (int)dock, Color.getCPtr(color), RectI.getCPtr(subregion)); IImageElement ret = (cPtr == global::System.IntPtr.Zero) ? null : new IImageElement(cPtr, false); if (IronSightEnginePINVOKE.SWIGPendingException.Pending) { throw IronSightEnginePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public VehiclePanel(Rectangle location, DockType dockType, Vehicle vehicle) : base(location, dockType, true) { this.vehicle = vehicle; name = "VehiclePanel"; drawSpriteBack = true; spriteBack = GraphicsManager.GetPreBuilt(Engine.ContentStorage.PrebuiltSprite.InGameMenuBack); transparency = 1f; AddBorder(2, Resizing.NONE, 40); AddHeading(40, vehicle.GetIdString(), GraphicsManager.GetSpriteFont(Font.CarterOne16), Color.White, true, true, false, false, true, GraphicsManager.GetPreBuilt(Engine.ContentStorage.PrebuiltSprite.InGameHeadingBar)); AddControls(); SetMaxTransparency(0.95f); }
public DatabaseDesignerForm() { InitializeComponent(); toolBoxWindow = new ToolBoxWindow(); toolBoxWindow.Owner = this; toolBoxWindowDockType = DockType.Top ^ DockType.Right ^ DockType.Bottom; propertyWindow = new PropertyWindow(); propertyWindow.Owner = this; propertyWindowDockType = DockType.Top ^ DockType.Right ^ DockType.Bottom; }
void DisplayObject(ParameterCollection obj, DockType type, string[] options, int order) { if (order > maxOrder) { maxOrder = order; } string[] assemblyPaths = null; switch (type) { case DockType.Attachment: assemblyPaths = FileSource.Attachments.Keys.ToArray(); break; case DockType.Cycle: assemblyPaths = FileSource.Cycles.Keys.ToArray(); break; case DockType.Emitter: assemblyPaths = FileSource.EmittionTypes.Keys.ToArray(); break; default: assemblyPaths = FileSource.RenderTypes.Keys.ToArray(); break; } if (obj == null) { obj = new ParameterCollection(); obj.ObjectType = assemblyPaths[0]; } string name = Enum.GetName(typeof(DockType), type); SelectionDock dock = new SelectionDock(obj, panel, maxRow, name, options, name, assemblyPaths); dock.Index = order; dock.OnSelectionChanged += new ComboBoxSelectionChangedEvent(cboSelectionChanged); dock.Create(); dock.EndCreate(); docks.Add(dock); maxRow = dock.MaxRow; maxOrder++; }
public EditorView(Rectangle location, DockType dockType, CompressedBuilding compressedBuilding, EditorParams editorParams) : base(location, dockType, true) { this.editorParams = editorParams; camera = new Camera(containerCamera.worldCameraViewport, 4, Vector2.Zero, new Vector2(1000, 1000), false); camera.CenterOn(new Vector2(500, 500)); camera.setZoomIndex(5); camera.lockZoom = false; camera.lockKeyMove = false; canChangeFocusOrder = false; borderMap = new BorderMap(compressedBuilding, editorParams); this.compressedBuilding = compressedBuilding; inGrid = false; }
public Video(Rectangle localLocation, DockType dockType) : base(localLocation, dockType, true) { name = "Video"; alwaysOnTop = true; spriteBack = GraphicsManager.GetSpriteColour(3); AddBorder(2, Resizing.NONE, 3); AddHeading(50, "Video Settings", GraphicsManager.GetSpriteFont(Font.OpenSans20Bold), Color.White, false, false, false, false, false, GraphicsManager.GetSpriteColour(6)); drawSpriteBack = true; canChangeFocusOrder = false; AddButtons(); }
public TownPanel(Rectangle location, DockType dockType, Camera mainWorldCamera) : base(location, dockType, true) { name = "TownPanel"; this.mainWorldCamera = mainWorldCamera; drawSpriteBack = true; spriteBack = GraphicsManager.GetPreBuilt(Engine.ContentStorage.PrebuiltSprite.InGameMenuBack); transparency = 1f; AddBorder(2, Resizing.NONE, 40); AddHeading(40, "Towns", GraphicsManager.GetSpriteFont(Font.CarterOne16), Color.White, true, false, false, false, true, GraphicsManager.GetPreBuilt(Engine.ContentStorage.PrebuiltSprite.InGameHeadingBar)); AddControls(); SetMaxTransparency(0.95f); }
public virtual Result CreateElement(ITexture tex, int x, int y, DockType dock, Color color, int zorder, SWIGTYPE_p_p_IImageElement element, SWIGTYPE_p_void elementuser) { Result ret = new Result(IronSightEnginePINVOKE.IHUD_CreateElement__SWIG_0(swigCPtr, ITexture.getCPtr(tex), x, y, (int)dock, Color.getCPtr(color), zorder, SWIGTYPE_p_p_IImageElement.getCPtr(element), SWIGTYPE_p_void.getCPtr(elementuser)), true); // if (IronSightEnginePINVOKE.SWIGPendingException.Pending) { throw IronSightEnginePINVOKE.SWIGPendingException.Retrieve(); } if (IronSightEnginePINVOKE.SWIGPendingException.Pending) { throw IronSightEnginePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public virtual Result CreateElement(ITexture tex, int x, int y, DockType dock, Color color) { Result ret = new Result(IronSightEnginePINVOKE.IHUD_CreateElement__SWIG_3(swigCPtr, ITexture.getCPtr(tex), x, y, (int)dock, Color.getCPtr(color)), true); // if (IronSightEnginePINVOKE.SWIGPendingException.Pending) { throw IronSightEnginePINVOKE.SWIGPendingException.Retrieve(); } if (IronSightEnginePINVOKE.SWIGPendingException.Pending) { throw IronSightEnginePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public override object GetView(object context = null) { if (context == null) { return(base.GetView(context)); } else { //1. Create corresponding ManagedContent. DockType type = (DockType)context; ManagedContent mc; if (type == DockType.Document) { mc = new DocumentContent(); Type = DockType.Document; } else { mc = new DockableContent(); (mc as DockableContent).HideOnClose = true; StateChangedEventManager.AddListener(mc as DockableContent, this); } mc.Content = base.GetView(null); mc.Name = Name; mc.IsCloseable = true; if (!ConventionManager.HasBinding(mc, ManagedContent.TitleProperty)) { mc.SetBinding(ManagedContent.TitleProperty, "DisplayName"); } if (!ConventionManager.HasBinding(mc, ManagedContent.IconProperty)) { Binding bind = new Binding("Icon") { Converter = ImgaeSourceResourceConverter.Default }; mc.SetBinding(ManagedContent.IconProperty, bind); } //2. Create Conductor to manage life cycle new ManagedContentConductor(this, mc); return(mc); } }
private static Vector2 GetFakeMousePosition(EditorWindow wnd, DockType position) { Vector2 mousePosition = Vector2.zero; switch (position) { case DockType.Left: mousePosition = new Vector2(20, wnd.position.size.y / 2); break; case DockType.Top: mousePosition = new Vector2(wnd.position.size.x / 2, 20); break; case DockType.Right: mousePosition = new Vector2(wnd.position.size.x - 20, wnd.position.size.y / 2); break; case DockType.Bottom: mousePosition = new Vector2(wnd.position.size.x / 2, wnd.position.size.y - 20); break; } return(new Vector2(wnd.position.x + mousePosition.x, wnd.position.y + mousePosition.y)); }
private void DockLeaf(TreeTrunk trunk, TreeLeaf leaf, DockType dockType) { if (!closedLeafs.Contains(leaf)) { Log.E("Err: Have Exist"); } else { trunk.DockLeaf(leaf, dockType); closedLeafs.Remove(leaf); if (onDockLeaf != null) { onDockLeaf(leaf); } } }
private void MainForm_Move(object sender, EventArgs e) { Screen scn = Screen.FromPoint(this.Location); Rectangle screenRect = scn.Bounds; if (this.Top <= screenRect.Top || DoSnap(this.Top, screenRect.Top)) { this.Top = screenRect.Top; } if (this.Left <= screenRect.Left || DoSnap(this.Left, screenRect.Left)) { this.Left = screenRect.Left; } if (this.Right >= screenRect.Right || DoSnap(screenRect.Right, this.Right)) { this.Left = screenRect.Right - this.Width; } if (this.Top != screenRect.Top && (this.Bottom >= screenRect.Bottom || DoSnap(screenRect.Bottom, this.Bottom))) { this.Top = screenRect.Bottom - this.Height; } if (this.Top == screenRect.Top) { dockLocation = DockType.Top; } else if (this.Left == screenRect.Left) { dockLocation = DockType.Left; } else if (this.Right == screenRect.Right) { dockLocation = DockType.Right; } else if (this.Bottom == screenRect.Bottom) { dockLocation = DockType.Bottom; } else { dockLocation = DockType.None; } }
public BuildingEditor(Rectangle localLocation, DockType docktype) : base(localLocation, docktype, true) { name = "Editor"; alwaysOnTop = true; spriteBack = GraphicsManager.GetSpriteColour(3); drawSpriteBack = true; canChangeFocusOrder = false; AddBorder(2, Resizing.NONE, 3); AddHeading(50, "Building Editor", GraphicsManager.GetSpriteFont(Font.OpenSans20Bold), Color.White, false, false, false, false, false, GraphicsManager.GetSpriteColour(6)); buildingsBinary = Data.LoadBuildingsBinary(); AddControls(); }
public Controls(Rectangle localLocation, DockType dockType) : base(localLocation, dockType, true) { state = ActionState.None; name = "Controls"; alwaysOnTop = true; spriteBack = GraphicsManager.GetSpriteColour(3); drawSpriteBack = true; canChangeFocusOrder = false; AddBorder(2, Resizing.NONE, 3); AddHeading(50, "Control Settings", GraphicsManager.GetSpriteFont(Font.OpenSans20Bold), Color.White, false, false, false, false, false, GraphicsManager.GetSpriteColour(6)); SetSizeBounds(0, 0, 900, 2000); AddScrollV(15, 6, 20); AddButtons(); }
public CommunicationViewer(DockType dock) { InitializeComponent(); Version LibraryVersion = Assembly.GetExecutingAssembly().GetName().Version; DateTime BuildDate = new DateTime(2000, 1, 1).AddDays(LibraryVersion.Build).AddSeconds(LibraryVersion.Revision * 2); this.Text = string.Format("CommViewer V{0}.{1}.{2} {3}", LibraryVersion.Major, LibraryVersion.Minor, LibraryVersion.Revision, BuildDate.ToString("yyyyMMddHHmmss")); this.dock = dock; SetDockType(dock); SetTransparenceLevel(TransparenceLevel.Low); this.VisibleChanged += new EventHandler(Viewer_VisibleChanged); channels = new Dictionary <string, CommunicationChannel>(); displayFilters = new Dictionary <string, string>(); }
private static void SetDocking(DockedMetroWindow dockWindow, DockType docType) { switch (dockWindow.DockingType) { case DockType.TopLeft: SetDockingLeftTop(dockWindow); break; case DockType.BottomRight: SetDockingBottomRight(dockWindow); break; case DockType.BottomLeft: SetDockingBottomLeft(dockWindow); break; } }
public BuildingPicker(Rectangle location, DockType dockType, CompressedBuilding compressedBuilding, EditorParams editorParams) : base(location, dockType, true) { this.compressedBuilding = compressedBuilding; this.editorParams = editorParams; drawSpriteBack = true; spriteBack = GraphicsManager.GetPreBuilt(Engine.ContentStorage.PrebuiltSprite.EditorPanelBackGrey); AddBorder(3, Resizing.NONE, 1); AddHeading(40, "Building Picker", GraphicsManager.GetSpriteFont(Font.OpenSans18), Color.White, false, false, false, false, true, GraphicsManager.GetSpriteColour(6)); AddUiControl(new Label("Index", Font.OpenSans24Bold, Color.White, new Vector2(195, 310), true, "")); AddUiControl(new PictureBox("Picture", new Rectangle(100, 80, 192, 192), null)); AddUiControl(new Box("Box", new Rectangle(90, 70, 212, 212), 3, 0, 20, true, false)); AddUiControl(new ButtonBlueMedium("Back", new Point(30, 360), "(Q) >", Color.White)); AddUiControl(new ButtonBlueMedium("Next", new Point(210, 360), "(E) >", Color.White)); SetSamplePiece(); }
public MainForm() { InitializeComponent(); this.DoubleBuffered = true; this.editMode = false; HotKeyManager.MainForm = this; noteEditControl.closeButton.Click += (s, e) => { preventCollapse = true; if (MessageBox.Show("Are you sure you want to delete selected items?", "Delete selected", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { RemoveNote(noteEditControl.Note); notesController.DeleteNote(noteEditControl.Note); noteEditControl.Note = null; CloseNoteEditControl(); } preventCollapse = false; }; noteEditControl.okButton.Click += (s, e) => { UpdateNote(noteEditControl.Note); notesController.DeleteNote(noteEditControl.Note); notesController.AddNote(noteEditControl.Note); notesController.SaveNotes(); noteEditControl.Note = null; CloseNoteEditControl(); }; normalHeight = Height; normalWidth = Width; normalTop = Top; normalLeft = Left; dockLocation = DockType.None; isExpanded = true; preventCollapse = false; notesController = new NotesController(); notesController.LoadNotes(); FillNotes(); }
public GameView(Rectangle location, DockType dockType) : base(location, dockType, true) { canChangeFocusOrder = false; world = WorldController.world; mapObjectsDraw = new MapObjectsDraw(); Vector2 cameraMin = new Vector2(GroundLayerController.tileSize, GroundLayerController.tileSize); Vector2 cameraMax = new Vector2((world.worldWidth * GroundLayerController.tileSize) - GroundLayerController.tileSize, (world.worldHeight * GroundLayerController.tileSize) - GroundLayerController.tileSize); camera = new Camera(containerCamera.worldCameraViewport, 4, cameraMin, cameraMax, false); camera.clampToMap = true; camera.CenterOn(new Vector2(24000, 24000)); camera.UpdateDrawPoints(GroundLayerController.tileSize, world.worldWidth, world.worldHeight); debugLabel = new Label("DEBUG", Font.Anita14, Color.White, new Vector2(300, 20), false, ""); camera.lockZoom = false; camera.lockKeyMove = false; backingWhite = GraphicsManager.GetSpriteColour(20); InitRendering(); //we can not set our container camera to be scrollable as that would simply bug our input and draw out }
public ShadowPicker(Rectangle location, DockType dockType, CompressedBuilding compressedBuilding, EditorParams editorParams) : base(location, dockType, true) { this.editorParams = editorParams; this.compressedBuilding = compressedBuilding; drawSpriteBack = true; spriteBack = GraphicsManager.GetPreBuilt(Engine.ContentStorage.PrebuiltSprite.EditorPanelBackGrey); AddBorder(3, Resizing.NONE, 1); AddHeading(40, "Shadow Picker", GraphicsManager.GetSpriteFont(Font.OpenSans18), Color.White, false, false, false, false, true, GraphicsManager.GetSpriteColour(6)); editStyleCombo = new ComboEditorCycleNoLabel("Side", "", new Point(5, 10), true, false, true); editStyleCombo.AddCycleObject(new CycleObject("Left Shadows", ShadowSide.LEFT)); editStyleCombo.AddCycleObject(new CycleObject("Right Shadows", ShadowSide.RIGHT)); AddUiControl(editStyleCombo); AddUiControl(new Label("Index", Font.OpenSans24Bold, Color.White, new Vector2(195, 320), true, "")); AddUiControl(new ButtonBlueMedium("Back", new Point(30, 360), "(Q) >", Color.White)); AddUiControl(new ButtonBlueMedium("Next", new Point(210, 360), "(E) >", Color.White)); SetSampleShadow(); }
public Vector2 Offset; //Tile-space offset from machine origin #endregion Fields #region Constructors public MachineDock(object source, DockType type) : base(source, type) { //just call superconstructor }
public Dock(object source, DockType t) { Source = source; Type = t; }
public void ToggleView(DockType dt) { switch (dt) { case DockType.FileExplorer: MainDockingForm.Update(FileExplorer, DockState.DockRight); break; case DockType.GraphExplorer: MainDockingForm.Update(GraphExplorer, DockState.DockRight); break; case DockType.UpdateBand: MainDockingForm.Update(UpDateBand,DockState.DockBottom); break; default: break; } }
private void AdjustSplitter(DockType dockType, SplitContainer splitter, ref Control originContainer) { Control parentContainer = null; splitter.Width = this.Size.Width * 2; if (dockType == DockType.Left || dockType == DockType.Right) { splitter.Orientation = Orientation.Vertical; if (dockType == DockType.Left) { parentContainer = splitter.Panel1; originContainer = splitter.Panel2; splitter.SplitterDistance = this.Size.Width; splitter.FixedPanel = FixedPanel.Panel1; } else { parentContainer = splitter.Panel2; originContainer = splitter.Panel1; splitter.SplitterDistance = splitter.Width - this.Size.Width; splitter.FixedPanel = FixedPanel.Panel2; } } else if (dockType != DockType.Fill) { splitter.Orientation = Orientation.Horizontal; if (dockType == DockType.Top) { parentContainer = splitter.Panel1; originContainer = splitter.Panel2; splitter.SplitterDistance = this.Size.Height; splitter.FixedPanel = FixedPanel.Panel1; } else { parentContainer = splitter.Panel2; originContainer = splitter.Panel1; splitter.SplitterDistance = splitter.Height - this.Size.Height; splitter.FixedPanel = FixedPanel.Panel2; } } }
public virtual void EmbedInto(Control targetControl, DockType dockType, bool isFixedSize = false) { IDockableTag target = null; if (!(targetControl.Tag is IDockableTag)) { return; } target = targetControl.Tag as IDockableTag; if (target == null) { target = new DockTag { ContentRegion = targetControl }; targetControl.Tag = target; } target.AddForm(this); Control container = target.GetContentRegion(); if (container == null) { return; } originalParent = targetControl; SplitContainer splitter = new SplitContainer(); splitter.IsSplitterFixed = isFixedSize; Control originContainer = null; Control parentContainer = PickSplitter(dockType, splitter, ref originContainer); if (parentContainer == null) { parentContainer = container; originContainer = container; } target.SetContentRegion(originContainer); if (container.Controls.Count > 0) { if (originContainer == null) { return; } for (int l = container.Controls.Count - 1, i=l; i >= 0; i--) { Control c = container.Controls[i]; container.Controls.Remove(c); originContainer.Controls.Add(c); } } container.Controls.Add(splitter); splitter.Dock = DockStyle.Fill; targetControl.Tag = target; EmbedInto(parentContainer, true); }
public static SplitContainer Embed(Control parentControl, Control childControl, DockType dock, bool isFixedSize = false) { if (parentControl == null || childControl == null) { return null; } if (!(childControl is EmbededForm) || EmbededForm.IsEmbeded(childControl)) { return null; } IDockableTag tag = parentControl.Tag as IDockableTag; if (tag == null) { tag = new DockTag { ContentRegion = parentControl }; parentControl.Tag = tag; } tag.AddForm(childControl); Control container = tag.GetContentRegion(); if (container == null) { return null; } SplitContainer splitter = new SplitContainer(); splitter.IsSplitterFixed = isFixedSize; Control originContainer = null; Control parentContainer = AdjustSplitter(childControl, dock, splitter, ref originContainer); if (parentContainer == null) { parentContainer = container; originContainer = container; } tag.SetContentRegion(originContainer); if (container.Controls.Count > 0) { if (originContainer == null) { return null; } foreach (Control c in container.Controls) { container.Controls.Remove(c); originContainer.Controls.Add(c); } } container.Controls.Add(splitter); splitter.Dock = DockStyle.Fill; parentControl.Tag = tag; EmbededForm.Embed(childControl, parentContainer, true, true); return splitter; }
public SplitContainer Embed(Control childControl, DockType dock, bool isFixedSize = false) { if (!isBeginEmbed) { return null; } return DockForm.Embed(this, childControl, dock, isFixedSize); }