3 overrides of Control
System.Windows.Forms.Design (3)
System\Windows\Forms\Design\ComboBoxDesigner.cs (1)
22public override ComboBox Control => (ComboBox)Component;
System\Windows\Forms\Design\DataGridViewDesigner.cs (1)
16public override DataGridView Control => (DataGridView)Component;
System\Windows\Forms\Design\ToolStripPanelDesigner.cs (1)
88public override ToolStripPanel Control => (ToolStripPanel)Component;
291 references to Control
System.Windows.Forms.Design (285)
System\Windows\Forms\Design\Behavior\BehaviorService.cs (1)
807snapLineInfo.Append($"{line}\tAssociated Control = {designer.Control.Name}:::");
System\Windows\Forms\Design\Behavior\DragAssistanceManager.cs (3)
198Rectangle controlRect = controlDesigner.Control.ClientRectangle; 200Rectangle controlBounds = controlDesigner.Control.Bounds; 202controlBounds.Location = controlRect.Location = _behaviorService.ControlToAdornerWindow(controlDesigner.Control);
System\Windows\Forms\Design\Behavior\TableLayoutPanelBehavior.cs (1)
119_resizeTransaction = host.CreateTransaction(string.Format(SR.TableLayoutPanelRowColResize, (isColumn ? "Column" : "Row"), _designer.Control.Site.Name));
System\Windows\Forms\Design\ButtonBaseDesigner.cs (3)
63int baseline = DesignerUtils.GetTextBaseline(Control, alignment); 69if (Control is CheckBox or RadioButton) 80if (Control is CheckBox)
System\Windows\Forms\Design\ControlDesigner.cs (109)
78private DesignerControlCollection Controls => _controls ??= new DesignerControlCollection(Control); 84Point loc = Control.Location; 86if (Control.Parent is ScrollableControl parent) 96if (Control.Parent is ScrollableControl parent) 102Control.Location = value; 115foreach (Control control in Control.Controls) 131=> accessibilityObj ??= new ControlDesignerAccessibleObject(this, Control); 236if (Control.Parent is not null && Control.Parent.IsMirrored) 288if (Control.Parent is { } parent) 290PInvokeCore.MapWindowPoints(Control, parent, ref nativeOffset); 293Point offset = Control.Location; 296if (Control.IsMirrored != Control.Parent?.IsMirrored) 298offset.Offset(Control.Width, 0); 343internal IList<SnapLine> EdgeAndMarginSnapLines() => EdgeAndMarginSnapLines(Control.Margin); 348int width = Control.Width; 349int height = Control.Height; 408=> parentDesigner is ParentControlDesigner p && !Control.Contains(p.Control); 434Control, 455Control.DataBindings.CollectionChanged -= _dataBindingsCollectionChanged; 460_inheritanceUI.RemoveInheritedControl(Control); 474UnhookChildControls(Control); 481Control.ControlAdded -= OnControlAdded; 482Control.ControlRemoved -= OnControlRemoved; 483Control.ParentChanged -= OnParentChanged; 484Control.SizeChanged -= OnSizeChanged; 485Control.LocationChanged -= OnLocationChanged; 486Control.EnabledChanged -= OnEnabledChanged; 607Control rc = Control; 669=> _moveBehavior ??= new ContainerSelectorBehavior(Control, Component.Site); 682Rectangle translatedBounds = BehaviorService?.ControlRectInAdornerWindow(Control) ?? Rectangle.Empty; 686Control? parent = Control.Parent; 691Rectangle controlRect = Control.RectangleToScreen(Control.ClientRectangle); 700if (TryGetService(out ISelectionService? sel) && sel.GetComponentSelected(Control)) 702g = new ControlBodyGlyph(translatedBounds, cursor, Control, MoveBehavior); 715g ??= new ControlBodyGlyph(translatedBounds, cursor, Control, this); 741Rectangle translatedBounds = BehaviorService.ControlRectInAdornerWindow(Control); 951Control.DataBindings.CollectionChanged += _dataBindingsCollectionChanged; 953Control.ControlAdded += OnControlAdded; 954Control.ControlRemoved += OnControlRemoved; 955Control.ParentChanged += OnParentChanged; 957Control.SizeChanged += OnSizeChanged; 958Control.LocationChanged += OnLocationChanged; 965if (Control.IsHandleCreated) 976_inheritanceUI?.AddInheritedControl(Control, InheritanceAttribute.InheritanceLevel); 983Control.Visible = true; 987Control.Enabled = true; 991Control.EnabledChanged += OnEnabledChanged; 994AllowDrop = Control.AllowDrop; 1019if (Control.IsHandleCreated) 1075Control.Enabled = true; 1116foreach (Control control in Control.Controls) 1153parentDesigner.AddControl(Control, defaultValues); 1168if (c != Control && c.Dock == DockStyle.None) 1222PInvoke.RevokeDragDrop(Control); 1232Control control = Control; 1235((IDropTarget)Control).OnDragEnter(de); 1253Control control = Control; 1256((IDropTarget)Control).OnDragDrop(de); 1267Control control = Control; 1270((IDropTarget)Control).OnDragLeave(e); 1280Control control = Control; 1283((IDropTarget)Control).OnDragOver(de); 1315Control.Capture = true; 1324Control.Capture = false; 1438DropSourceBehavior dsb = new(dragControls, Control.Parent, _mouseDragLast); 1453Control ctl = Control; 1482Control ctl = Control; 1511Control ctl = Control; 1577if (Control.Dock != DockStyle.None) 1796if (m.HWnd == Control.Handle) 1875PInvokeCore.SendMessage(Control, PInvokeCore.WM_SETFOCUS); 1907if (_toolPassThrough && Control.Parent is not null) 1910Control.Parent, 1956if (_toolPassThrough && Control.Parent is not null) 1959Control.Parent, 2003if (_toolPassThrough && Control.Parent is not null) 2006Control.Parent, 2027using PaintEventArgs e = new(g, Control.ClientRectangle); 2043if (Control is null) 2065if (m.HWnd != Control.Handle) 2069PInvokeCore.MapWindowPoints(m.HWND, Control, ref point); 2071PInvokeCore.MapWindowPoints(m.HWND, Control, ref clip); 2091paintRect.Location = Control.PointToScreen(paintRect.Location); 2115if (Control is not null && Control.Size != Control.ClientSize && Control.Parent is { } parent) 2118Rectangle controlScreenBounds = new(parent.PointToScreen(Control.Location), Control.Size); 2119Rectangle clientAreaScreenBounds = new(Control.PointToScreen(Point.Empty), Control.ClientSize); 2151Control.Invalidate(); 2244Rectangle clientRectangle = Control.ClientRectangle; 2259Control.Font.FontFamily, 2260Math.Max(SystemInformation.ToolWindowCaptionHeight - SystemInformation.BorderSize.Height - 2, Control.Font.Height), 2292e.Graphics.DrawString(exceptionText, errorFont, new SolidBrush(Control.ForeColor), textRect, stringFormat); 2381pt = Control.PointToScreen(pt); 2384pt = Control.Parent!.PointToClient(pt); 2399Control? child = Control.FromHandle(hwndChild); 2419if (child is null || Control is UserControl) 2460HookChildHandles(PInvoke.GetWindow(Control, GET_WINDOW_CMD.GW_CHILD)); 2461HookChildControls(Control); 2475owner ??= Control; 2495foreach (Control c in Control.Controls) 2500Control.Invalidate(true);
System\Windows\Forms\Design\ControlDesigner.DesignerWindowTarget.cs (3)
15Control control = designer.Control; 30_designer.Control.WindowTarget = _oldTarget; 60currentDesigner.SetUnhandledException(currentDesigner.Control, ex);
System\Windows\Forms\Design\ControlDesigner.TransparentBehavior.cs (1)
46if (_designer.Control is { } control)
System\Windows\Forms\Design\DateTimePickerDesigner.cs (1)
27int baseline = DesignerUtils.GetTextBaseline(Control, ContentAlignment.MiddleLeft);
System\Windows\Forms\Design\DocumentDesigner.cs (12)
68ContainerControl c = Control as ContainerControl; 79ContainerControl c = Control as ContainerControl; 96ContainerControl c = Control as ContainerControl; 108ContainerControl c = Control as ContainerControl; 131return Control.BackColor; 141Control.BackColor = value; 553else if (autoSize && (mode == AutoSizeMode.GrowAndShrink) && !(Control is Form)) 679Control.BackColor = SystemColors.Control; 744if (Control.IsHandleCreated) 780_frame.Initialize(Control); 894|| (cd.Control is Form form && form.TopLevel); 1090Control control = Control;
System\Windows\Forms\Design\DocumentDesigner.DocumentInheritanceService.cs (1)
70Control parent = _designer.Control;
System\Windows\Forms\Design\FlowLayoutPanelDesigner .cs (1)
355private new FlowLayoutPanel Control => base.Control as FlowLayoutPanel;
System\Windows\Forms\Design\FlowPanelDesigner.cs (1)
37internal override void AddChildControl(Control newChild) => Control.Controls.Add(newChild);
System\Windows\Forms\Design\FormDocumentDesigner.cs (11)
140get => ((Form)Control).IsMdiContainer; 145UnhookChildControls(Control); 148((Form)Control).IsMdiContainer = value; 151HookChildControls(Control); 198if (Control.Padding == Padding.Empty && snapLines is not null) 232get => Control.Size; 239Control.Size = value; 343Form form = (Form)Control; 398if (Control is { } control && control.IsHandleCreated) 410if (Control is { } control && control.IsHandleCreated) 423if (Control is Form form)
System\Windows\Forms\Design\GroupBoxDesigner.cs (3)
26GroupBox gb = (GroupBox)Control; 77Control control = Control; 78Rectangle rectangle = Control.DisplayRectangle;
System\Windows\Forms\Design\LabelDesigner.cs (2)
43int baseline = DesignerUtils.GetTextBaseline(Control, alignment); 65Label? label = Control as Label;
System\Windows\Forms\Design\ListBoxDesigner.cs (1)
183ListBox listBox = (ListBox)Control;
System\Windows\Forms\Design\ListViewDesigner.cs (4)
33ListView lv = Control as ListView; 66HookChildHandles((HWND)Control.Handle); 78Point listViewPoint = Control.PointToClient(point); 110HookChildHandles((HWND)Control.Handle);
System\Windows\Forms\Design\MaskedTextBoxDesigner.cs (4)
209MaskedTextBox? maskedTextBox = Control as MaskedTextBox; 227MaskedTextBox? maskedTextBox = Control as MaskedTextBox; 246MaskedTextBox? maskedTextBox = Control as MaskedTextBox; 259MaskedTextBox? maskedTextBox = Control as MaskedTextBox;
System\Windows\Forms\Design\MonthCalendarDesigner.cs (2)
24if (Control.Parent is null || !Control.Parent.IsMirrored)
System\Windows\Forms\Design\PanelDesigner.cs (4)
37Rectangle rc = Control.ClientRectangle; 72Color penColor = Control.BackColor.GetBrightness() < .5 ? 73ControlPaint.Light(Control.BackColor) : 74ControlPaint.Dark(Control.BackColor);
System\Windows\Forms\Design\ParentControlDesigner.cs (59)
182Control control = Control; 192foreach (Control child in Control.Controls) 261Control control = Control; 270foreach (Control child in Control.Controls) 293protected virtual Control GetParentForComponent(IComponent component) => Control; 311Rectangle displayRectangle = Control.DisplayRectangle; 408foreach (Control child in Control.Controls) 420if (newChild.Left == 0 && newChild.Top == 0 && newChild.Width >= Control.Width && newChild.Height >= Control.Height) 428Control.Controls.Add(newChild); 429Control.Controls.SetChildIndex(newChild, 0); 455if (host is not null && newChild is not null && !Control.Contains(newChild) 464location = Control.PointToClient(location); 541Rectangle snappedBounds = DesignerUtils.GetBoundsFromToolboxSnapDragDropInfo(e, bounds, Control.IsMirrored); 556PropertyDescriptor controlsProp = TypeDescriptor.GetProperties(Control)["Controls"]; 557_changeService?.OnComponentChanging(Control, controlsProp); 588_changeService?.OnComponentChanged(Control, controlsProp, Control.Controls, Control.Controls); 685if (HasComponent && Control is ScrollableControl control) 773return CanParent(controlDesigner.Control); 783return !control.Contains(Control); 828comp = GetOleDragHandler().CreateTool(tool, Control, x, y, width, height, hasLocation, hasSize, _toolboxSnapDragDropEventArgs); 864Rectangle rect = screenCoords ? Control.RectangleToClient(value) : value; 868Control control = Control; 902return cd.Control; 917Control parent = Control; 996Rectangle controlRect = BehaviorService.ControlRectInAdornerWindow(Control); 998Control parent = Control.Parent; 1014return new ControlBodyGlyph(nonClipRect, Cursor.Current, Control, this); 1025return new ControlBodyGlyph(controlRect, Cursor.Current, Control, this); 1075Control parent = Control.Parent; 1199if (Control is ScrollableControl control) 1268if (selectedControls.Contains(Control)) 1270selectedControls.Remove(Control); 1276ReParentControls(Control, selectedControls, string.Format(SR.ParentControlDesignerLassoShortcutRedo, Control.Site.Name), host); 1324if (comp is not null && comp.Parent is not null && comp.Parent == Control) 1331_changeService.OnComponentChanging(Control, TypeDescriptor.GetProperties(Control)["Controls"]); 1343_changeService.OnComponentChanged(Control, TypeDescriptor.GetProperties(Control)["Controls"]); 1361_changeService.OnComponentChanging(Control, TypeDescriptor.GetProperties(Control)["Controls"]); 1555if (InheritanceAttribute == InheritanceAttribute.InheritedReadOnly && draggedControl.Parent != Control) 1707Control control = Control; 1777Control.Capture = false; 1824location = Control.PointToClient(location); 1965_mouseDragOffset = Control.RectangleToClient(_mouseDragOffset); 1967_mouseDragOffset = Control.RectangleToScreen(_mouseDragOffset); 2006DesignerUtils.DrawFrame(_graphics, newRegion, _mouseDragFrame, Control.BackColor); 2015offset = Control.PointToClient(offset); 2027Control control = Control; 2029Rectangle displayRect = Control.DisplayRectangle; 2030Rectangle clientRect = Control.ClientRectangle; 2055BehaviorService.Invalidate(BehaviorService.ControlRectInAdornerWindow(Control)); 2274Control control = Control; 2283Control control = Control; 2533return Control;
System\Windows\Forms\Design\PictureBoxDesigner.cs (1)
32Control ctl = Control;
System\Windows\Forms\Design\RichTextBoxDesigner.cs (4)
29Control control = Control; 93return Control.Text; 97string oldText = Control.Text; 105Control.Text = value;
System\Windows\Forms\Design\ScrollableControlDesigner.cs (3)
30ScrollableControl f = (ScrollableControl)Control; 65Control.Invalidate(); 66Control.Update();
System\Windows\Forms\Design\SelectionUIService.SelectionUIItem.cs (1)
85_control = cd.Control;
System\Windows\Forms\Design\SplitContainerDesigner.cs (1)
284svc.SetSelectedComponents(new object[] { Control });
System\Windows\Forms\Design\SplitterDesigner.cs (2)
25Control control = Control; 58Control.Invalidate();
System\Windows\Forms\Design\SplitterPanelDesigner.cs (4)
146Control control = Control; 164Control control = Control; 180Control control = Control; 261public override SelectionRules SelectionRules => Control.Parent is SplitContainer ? SelectionRules.Locked : SelectionRules.None;
System\Windows\Forms\Design\TabControlDesigner.cs (11)
73if (Control is not null) 75_removeVerb.Enabled = Control.Controls.Count > 0; 112public override bool CanParent(Control control) => (control is TabPage && !Control.Contains(control)); 118_removeVerb.Enabled = Control.Controls.Count > 0; 124TabControl tc = ((TabControl)Control); 158if (HasComponent && Control is TabControl tabControl) 172TabControl tc = ((TabControl)Control); 180Point hitTest = Control.PointToClient(point); 572TabControl tc = ((TabControl)Control); 573Point dropPoint = Control.PointToClient(new Point(de.X, de.Y)); 637BehaviorService.Invalidate(BehaviorService.ControlRectInAdornerWindow(Control));
System\Windows\Forms\Design\TableLayoutPanelDesigner.cs (12)
118_controls ??= new DesignerTableLayoutControlCollection((TableLayoutPanel)Control); 497Control existingControl = ((TableLayoutPanel)Control).GetControlFromPosition(newControlPosition.X, newControlPosition.Y); 848Rectangle rc = Control.DisplayRectangle; 1078Point controlLoc = BehaviorService.ControlToAdornerWindow(Control); 1079Rectangle checkBounds = new(controlLoc, Control.ClientSize); // Can't use Control.Size since that will include any scrollbar 1172Control.ControlAdded += OnControlAdded; 1173Control.ControlRemoved += OnControlRemoved; 1181for (int i = 0; i < Control.Controls.Count; i++) 1183TypeDescriptor.AddAttributes(Control.Controls[i], InheritanceAttribute.InheritedReadOnly); 1277Control existingControl = ((TableLayoutPanel)Control).GetControlFromPosition(dropPoint.X, dropPoint.Y); 1454if (c is not null && c.Parent is not null && c.Parent.Equals(Control) && e.Member is not null && (e.Member.Name == "Row" || e.Member.Name == "Column")) 1708BehaviorService.Invalidate(BehaviorService.ControlRectInAdornerWindow(Control));
System\Windows\Forms\Design\TabPageDesigner.cs (2)
19Control ctl = Control; 49ControlBodyGlyph g = new(translatedBounds, Cursor.Current, Control, this);
System\Windows\Forms\Design\TextBoxBaseDesigner.cs (5)
29int baseline = DesignerUtils.GetTextBaseline(Control, Drawing.ContentAlignment.TopLeft); 63get => Control.Text; 66Control.Text = value; 71((TextBoxBase)Control).Select(0, 0); 82Control.Text = string.Empty;
System\Windows\Forms\Design\TextBoxDesigner.cs (2)
75TextBox tb = (Control as TextBox)!; 89TextBox tb = (Control as TextBox)!;
System\Windows\Forms\Design\ToolStripDesigner.cs (5)
452Control.Visible = value; 1391point = Control.PointToClient(point); 1426if (Control.IsHandleCreated) 2356if (!_currentVisible || !Control.Visible) 2359Control.Visible = true;
System\Windows\Forms\Design\TreeViewDesigner.cs (2)
52point = Control.PointToClient(point); 54PInvokeCore.SendMessage(Control, PInvoke.TVM_HITTEST, 0, ref _tvhit);
System\Windows\Forms\Design\UpDownBaseDesigner.cs (1)
45int baseline = DesignerUtils.GetTextBaseline(Control, Drawing.ContentAlignment.TopLeft);
System\Windows\Forms\Design\UserControlDocumentDesigner.cs (2)
28get => Control.ClientSize; 29set => Control.ClientSize = value;
System.Windows.Forms.Design.Tests (4)
ControlDesignerTests.cs (2)
35Control _ = controlDesigner.Control; 157using Control control = _designer.Control;
System\Windows\Forms\Design\RichTextBoxDesignerTests.cs (2)
28_designer.Control.IsHandleCreated.Should().Be(false); 30_designer.Control.IsHandleCreated.Should().Be(true);
System.Windows.Forms.UI.IntegrationTests (2)
DesignBehaviorsTests.cs (2)
325pe.Graphics.DrawString($"Design time \n{Control.Site?.Name} !", Control.Font, SystemBrushes.WindowText, new PointF(12, 12));