Here are the examples of the csharp api class System.Windows.Forms.Control.SetBounds(int, int, int, int, System.Windows.Forms.BoundsSpecified) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
23 Examples
0
1. Example
View licenseprivate void SceneBuilderForm_SizeChanged(object sender, System.EventArgs e) { // The size is changed. First scale the property window down. tabControlTools.SetBounds(0, 0, 0, (ClientSize.Height - tabControlTools.Location.Y) - 8, BoundsSpecified.Height); // Now scale the OpenGL window. openGLCtrlScene.SetBounds(0, 0, (ClientSize.Width - openGLCtrlScene.Location.X) - 8, (ClientSize.Height - openGLCtrlScene.Location.Y) - 8, BoundsSpecified.Size); }
0
2. Example
View licenseprivate void SpawnLeftSide() { Verify.State.IsTrue(_left == null); var size = Size; var bounds = new Rectangle( 0, ViewConstants.Spacing, Renderer.SideTabHeight, 0); int hspace = size.Width - (Renderer.SideTabHeight + ViewConstants.Spacing * 2); if(_right != null) hspace -= Renderer.SideTabHeight; if(_top != null) { if(_top.Width > hspace) { _top.Bounds = new Rectangle( Renderer.SideTabHeight + ViewConstants.Spacing, 0, hspace, Renderer.SideTabHeight); } else { _top.Left += Renderer.SideTabHeight; } bounds.Y += Renderer.SideTabHeight; } if(_bottom != null) { if(_bottom.Width > hspace) { _bottom.Bounds = new Rectangle( Renderer.SideTabHeight + ViewConstants.Spacing, size.Height - Renderer.SideTabHeight, hspace, Renderer.SideTabHeight); } else { _bottom.Left += Renderer.SideTabHeight; } } _rootControl.SetBounds( _rootControl.Left + Renderer.SideTabHeight, 0, _rootControl.Width - Renderer.SideTabHeight, 0, BoundsSpecified.X | BoundsSpecified.Width); _left = new ViewDockSide(this, AnchorStyles.Left) { Anchor = AnchorStyles.Left | AnchorStyles.Top, Bounds = bounds, Parent = this, }; }
0
3. Example
View licenseprivate void SpawnTopSide() { Verify.State.IsTrue(_top == null); var size = Size; var bounds = new Rectangle( ViewConstants.Spacing, 0, 0, Renderer.SideTabHeight); int vspace = size.Height - Renderer.SideTabHeight - ViewConstants.Spacing * 2; if(_bottom != null) vspace -= Renderer.SideTabHeight; if(_left != null) { if(_left.Height > vspace) { _left.Bounds = new Rectangle( 0, Renderer.SideTabHeight + ViewConstants.Spacing, Renderer.SideTabHeight, vspace); } else { _left.Top += Renderer.SideTabHeight; } bounds.X += Renderer.SideTabHeight; } if(_right != null) { if(_right.Height > vspace) { _right.Bounds = new Rectangle( size.Width - Renderer.SideTabHeight, Renderer.SideTabHeight + ViewConstants.Spacing, Renderer.SideTabHeight, vspace); } else { _right.Top += Renderer.SideTabHeight; } } _rootControl.SetBounds( 0, _rootControl.Top + Renderer.SideTabHeight, 0, _rootControl.Height - Renderer.SideTabHeight, BoundsSpecified.Y | BoundsSpecified.Height); _top = new ViewDockSide(this, AnchorStyles.Top) { Anchor = AnchorStyles.Left | AnchorStyles.Top, Bounds = bounds, Parent = this, }; }
0
4. Example
View licenseprotected override void InitForm() { base.InitForm(); this._objectL/n ..... /n //View Source file for more details /n }
0
5. Example
View licenseprotected override void InitForm() { base.InitForm(); this._objectL/n ..... /n //View Source file for more details /n }
0
6. Example
View licenseprivate void InitForm() { GroupLabel grplblAppearance = new GroupLabel(); /n ..... /n //View Source file for more details /n }
0
7. Example
View licensepublic override void Layout(ViewLayoutContext context) { Debug.Assert(context != null); // We take on all the available display area ClientRectangle = context.DisplayRectangle; // Are we allowed to change the layout of controls? if (!context.ViewManager.DoNotLayoutControls) { // If we have an actual control, position it with a pixel padding all around if (LastCustomControl != null) { LastCustomControl.SetBounds(ClientLocation.X + 1, ClientLocation.Y + 1, ClientWidth - 2, ClientHeight - 2); } } // Let child elements layout in given space base.Layout(context); }
0
8. Example
View licenseprivate void OnSelectedValueChanged(object sender, EventArgs e) { var item = _picker.SelectedValue; if(item == null) { return; } var control = GetOrCreateControl(item); int d = 0; if(_selectedControl != null) { d -= _selectedControl.Height; _selectedControl.Parent = null; _selectedControl = null; d -= 3; } _selectedControl = control; if(_selectedControl != null) { d += _selectedControl.Height; d += 3; } Height += d; if(_selectedControl != null) { _selectedControl.SetBounds(0, _picker.Bottom + 3, Width, 0, BoundsSpecified.X | BoundsSpecified.Y | BoundsSpecified.Width); _selectedControl.Parent = this; } }
0
9. Example
View licenseprotected override void InitForm() { Debug.Assert(GetBaseControl() != null); /n ..... /n //View Source file for more details /n }
0
10. Example
View licenseprotected override void OnLayout(LayoutEventArgs e) { if (!this.Visible || this.Height == 0) { return; } Control.ControlCollection controls = this.Controls; Size clientSize = ClientSize; int width = clientSize.Width - Padding.Horizontal - 12; Size proposedSize = new Size(width, Int32.MaxValue); int top = Padding.Top + AutoScrollPosition.Y; for (int i = 0; i < controls.Count; i++) { Control ctl = controls[i]; Size size = ctl.GetPreferredSize(proposedSize); ctl.SetBounds(Padding.Left, top, size.Width, size.Height); top += ctl.Height; } if (top >= this.ClientSize.Height) { AdjustFormScrollbars(true); AutoScrollMinSize = new Size(ClientSize.Width, top); } else { AutoScrollMinSize = Size.Empty; AdjustFormScrollbars(false); } }
0
11. Example
View licensevoid CollapsiblePanel_SizeChanged(object sender, EventArgs e) { if (this.DesignMode) { if (_panelState == PanelStateOptions.Expanded) { _expandedHeight = this.Height - titlePanel.Height; } else { ///Final user can only resize the user control when it is expanded this.SetBounds(this.Location.X, this.Location.Y, this.Size.Width, titlePanel.Height); } if (this.Parent != null) { if (this.Parent.Size.Width != this.Size.Width) { FitToParent = false; } } } MoveNextPanel(); }
0
12. Example
View licenseprivate void ToggleState(object sender, EventArgs e) { if (_isCollapsed) /n ..... /n //View Source file for more details /n }
0
13. Example
View licenseprivate void RemoveAllSides() { SuspendLayout(); if(_left != null) { _left.Parent = null; _left.Dispose(); _left = null; } if(_top != null) { _top.Parent = null; _top.Dispose(); _top = null; } if(_right != null) { _right.Parent = null; _right.Dispose(); _right = null; } if(_bottom != null) { _bottom.Parent = null; _bottom.Dispose(); _bottom = null; } RootControl.SetBounds( ViewConstants.Spacing, ViewConstants.Spacing, Width - ViewConstants.Spacing * 2, Height - ViewConstants.Spacing * 2, BoundsSpecified.All); ResumeLayout(true); }
0
14. Example
View licenseprivate void InitForm() { Debug.Assert(GetBaseControl() != null); _/n ..... /n //View Source file for more details /n }
0
15. Example
View licenseprivate void InitializeComponent() { _btnOK = new Button(); /n ..... /n //View Source file for more details /n }
0
16. Example
View licensepublic void UpdateAutosplits(List<AutoSplit> autoSplits) { // Unbinds and clears the binding list. ClearAutoSplitBindings(); int y = 0; autosplitPanel.Controls.Clear(); foreach (AutoSplit autoSplit in autoSplits) { Label splitLabel = new Label(); splitLabel.SetBounds(0, y, autosplitPanel.Bounds.Width, 16); splitLabel.Text = autoSplit.Name; splitLabel.ForeColor = autoSplit.IsReached ? Color.Green : Color.Red; Action<AutoSplit> splitReached = s => splitLabel.ForeColor = Color.Green; Action<AutoSplit> splitReset = s => splitLabel.ForeColor = Color.Red; // Bind autosplit events. var binding = new AutosplitBinding(autoSplit, splitReached, splitReset); autoSplitBindings.Add(binding); autosplitPanel.Controls.Add(splitLabel); y += 16; } }
0
17. Example
View licensepublic static void EnsureInsideScreen(Form f) { if(f == null) { Debug.Assert(false); return; } try { if(!f.Visible) return; // No assert if(f.WindowState != FormWindowState.Normal) return; int x = f.Location.X; int y = f.Location.Y; int w = f.Size.Width; int h = f.Size.Height; Debug.Assert((x != -32000) && (x != -64000)); Debug.Assert(x != AppDefs.InvalidWindowValue); Debug.Assert((y != -32000) && (y != -64000)); Debug.Assert(y != AppDefs.InvalidWindowValue); Debug.Assert(w != AppDefs.InvalidWindowValue); Debug.Assert(h != AppDefs.InvalidWindowValue); Rectangle rect = new Rectangle(x, y, w, h); if(IsScreenAreaVisible(rect)) return; Screen scr = Screen.PrimaryScreen; Rectangle rectScr = scr.Bounds; BoundsSpecified bs = BoundsSpecified.Location; if((w > rectScr.Width) || (h > rectScr.Height)) { w = Math.Min(w, rectScr.Width); h = Math.Min(h, rectScr.Height); bs |= BoundsSpecified.Size; } x = rectScr.X + ((rectScr.Width - w) / 2); y = rectScr.Y + ((rectScr.Height - h) / 2); f.SetBounds(x, y, w, h, bs); } catch(Exception) { Debug.Assert(false); } }
0
18. Example
View licenseinternal void UnpinFromRight() { var w = Width; _grid.PerformDock(this, DockResult.AutoHideRight); _dockSide = _grid.RightSide; _viewContainer.SuspendLayout(); if(_tabs == null) { _viewContainer.SetBounds( ViewConstants.SideDockPanelBorderSize, 0, w, 0, BoundsSpecified.X | BoundsSpecified.Width); } else { _viewContainer.SetBounds( ViewConstants.SideDockPanelBorderSize, 0, w, Height - Renderer.HeaderHeight, BoundsSpecified.X | BoundsSpecified.Width | BoundsSpecified.Height); RemoveTabs(); } Width += ViewConstants.SideDockPanelBorderSize; _header.SetBounds( ViewConstants.SideDockPanelBorderSize, 0, w, 0, BoundsSpecified.X | BoundsSpecified.Width); _viewContainer.ResumeLayout(true); }
0
19. Example
View licenseinternal void UnpinFromBottom() { var h = Height; _grid.PerformDock(this, DockResult.AutoHideBottom); _dockSide = _grid.BottomSide; _viewContainer.SuspendLayout(); var headerHeight = Renderer.HeaderHeight; if(_tabs == null) { _viewContainer.Top = headerHeight + ViewConstants.SideDockPanelBorderSize; } else { _viewContainer.SetBounds( 0, ViewConstants.SideDockPanelBorderSize + headerHeight, 0, h - headerHeight, BoundsSpecified.Y | BoundsSpecified.Height); RemoveTabs(); } _header.Top = ViewConstants.SideDockPanelBorderSize; Height += ViewConstants.SideDockPanelBorderSize; _viewContainer.ResumeLayout(true); }
0
20. Example
View licensepublic override void Layout(ViewLayoutContext context) { Debug.Assert(context !=/n ..... /n //View Source file for more details /n }
0
21. Example
View licenseprivate void Undock() { switch(Status) { case ViewHostStatus.AutoHide: { _doc/n ..... /n //View Source file for more details /n }
0
22. Example
View licenseprivate void Form1_Load(object sender, System.EventArgs e) { // load PersistedDa/n ..... /n //View Source file for more details /n }
0
23. Example
View licenseprivate void ChangeDevice(DeviceSettings newDeviceSettings, Device deviceFromApp, bool forceRecreate/n ..... /n //View Source file for more details /n }