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