System\Windows\Forms\Control.cs (41)
1290public Rectangle Bounds
1446public Rectangle ClientRectangle => new Rectangle(0, 0, _clientWidth, _clientHeight);
1924public virtual Rectangle DisplayRectangle
4787Rectangle originalBounds;
4805Rectangle parentClient = _parent.ClientRectangle;
5212public void DrawToBitmap(Bitmap bitmap, Rectangle targetBounds)
5507internal virtual Rectangle ApplyBoundsConstraints(int suggestedX, int suggestedY, int proposedWidth, int proposedHeight)
5515Rectangle newBounds = new(suggestedX, suggestedY, 0, 0)
5596protected virtual Rectangle GetScaledBounds(Rectangle bounds, SizeF factor, BoundsSpecified specified)
5826private protected virtual IList<Rectangle> GetNeighboringToolsRectangles()
6160OnInvalidated(new InvalidateEventArgs(Rectangle.Ceiling(region.GetBounds(graphics))));
6211public void Invalidate(Rectangle rc)
6222public unsafe void Invalidate(Rectangle rc, bool invalidateChildren)
6839protected virtual void NotifyInvalidate(Rectangle invalidatedArea)
8670Rectangle cliprect = e.InvalidRect;
8673cliprect = Rectangle.Intersect(ClientRectangle, cliprect);
8938internal void PaintBackground(PaintEventArgs e, Rectangle rectangle) =>
8941internal void PaintBackground(PaintEventArgs e, Rectangle rectangle, Color backColor, Point scrollOffset = default)
8992private static void PaintBackColor(PaintEventArgs e, Rectangle rectangle, Color backColor)
9022Rectangle clientRectangle = ClientRectangle;
9023Rectangle rectangle = clientRectangle;
9051internal unsafe void PaintTransparentBackground(PaintEventArgs e, Rectangle rectangle, Region? transparentRegion = null)
9091Rectangle shift = new(-Left, -Top, parent.Width, parent.Height);
9094Rectangle newClipRect = new(
9607private protected virtual void PrintToMetaFileRecursive(HDC hDC, IntPtr lParam, Rectangle bounds)
9621Rectangle clientBounds = new(clientOffset, ClientSize);
10176public Rectangle RectangleToClient(Rectangle r)
10186public Rectangle RectangleToScreen(Rectangle r)
10597Rectangle rawScaledBounds = GetScaledBounds(Bounds, factor, specified);
10952Rectangle adjustedBounds = ApplyBoundsConstraints(x, y, width, height);
12626Rectangle clip;
13518void IArrangedElement.SetBounds(Rectangle bounds, BoundsSpecified specified)
13622Rectangle IKeyboardToolTip.GetNativeScreenRectangle() => GetToolNativeScreenRectangle();
13624IList<Rectangle> IKeyboardToolTip.GetNeighboringToolsRectangles() => GetNeighboringToolsRectangles();
13651private IList<Rectangle> GetOwnNeighboringToolsRectangles()
13656return Array.Empty<Rectangle>();
13659List<Rectangle> neighboringControlsRectangles = new(4);
13689internal virtual Rectangle GetToolNativeScreenRectangle()
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (23)
102internal LayoutData GetLayoutData(Rectangle contentBounds)
149internal static void DrawDitheredFill(Graphics g, Color color1, Color color2, Rectangle bounds)
155protected void Draw3DBorder(IDeviceContext deviceContext, Rectangle bounds, ColorData colors, bool raised)
181private void Draw3DBorderHighContrastRaised(IDeviceContext deviceContext, ref Rectangle bounds, ColorData colors)
239private static void Draw3DBorderNormal(IDeviceContext deviceContext, ref Rectangle bounds, ColorData colors)
284private void Draw3DBorderRaised(IDeviceContext deviceContext, ref Rectangle bounds, ColorData colors)
345protected internal static void Draw3DLiteBorder(IDeviceContext deviceContext, Rectangle r, ColorData colors, bool up)
375Rectangle bounds,
383Rectangle left = new(bounds.X, bounds.Y, size, bounds.Height);
384Rectangle right = new(bounds.X + bounds.Width - size, bounds.Y, size, bounds.Height);
385Rectangle top = new(bounds.X + size, bounds.Y, bounds.Width - size * 2, size);
386Rectangle bottom = new(bounds.X + size, bounds.Y + bounds.Height - size, bounds.Width - size * 2, size);
408internal static void DrawFlatFocus(IDeviceContext deviceContext, Rectangle r, Color color)
418private void DrawFocus(Graphics g, Rectangle r)
426internal virtual void DrawImageCore(Graphics graphics, Image image, Rectangle imageBounds, Point imageStart, LayoutData layout)
432Rectangle bounds = layout.Options.ClipImagesToClient
485internal static void DrawDefaultBorder(IDeviceContext deviceContext, Rectangle r, Color color, bool isDefault)
515Rectangle r = layout.TextBounds;
576internal void PaintButtonBackground(PaintEventArgs e, Rectangle bounds, Brush? background)
595Rectangle maxFocus = layout.Focus;
610Rectangle? clipRectangle = null)
618Rectangle imageClip = clipRectangle ?? Control.ClientRectangle;
648Rectangle clientRectangle,
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.LayoutOptions.cs (12)
28public Rectangle Client;
276layout.Face = Rectangle.Inflate(layout.Client, -fullBorderSize, -fullBorderSize);
295Rectangle textAdjusted = new(
302? Rectangle.Union(textAdjusted, layout.ImageBounds)
378Rectangle field = Rectangle.Inflate(layout.Face, -PaddingSize, -PaddingSize);
498Rectangle maxBounds = Rectangle.Inflate(layout.Field, -TextImageInset, -TextImageInset);
525Rectangle maxCombinedBounds = maxBounds;
530Rectangle combinedBounds = LayoutUtils.Align(combinedSize, maxCombinedBounds, ContentAlignment.MiddleCenter);
629layout.TextBounds = Rectangle.Intersect(layout.TextBounds, layout.Field);
644layout.ImageBounds = Rectangle.Intersect(layout.ImageBounds, layout.Field);
System\Windows\Forms\Controls\Buttons\ButtonInternal\CheckBoxBaseAdapter.cs (12)
36Rectangle bounds = layout.CheckBounds;
86Rectangle bounds,
119Rectangle bounds,
171Rectangle fullSize = layout.CheckBounds;
201internal static Rectangle DrawPopupBorder(Graphics g, Rectangle r, ColorData colors)
207internal static Rectangle DrawPopupBorder(PaintEventArgs e, Rectangle r, ColorData colors)
213internal static Rectangle DrawPopupBorder(HDC hdc, Rectangle r, ColorData colors)
294private static Bitmap GetCheckBoxImage(Color checkColor, Rectangle fullSize, ref Color cacheCheckColor, ref Bitmap? cacheCheckImage)
336layout.Focus = Control.AutoSize ? Rectangle.Inflate(layout.CheckBounds, -2, -2) : layout.Field;
System\Windows\Forms\Controls\Buttons\ButtonInternal\DarkMode\FlatButtonDarkModeRenderer.cs (12)
25public override Rectangle DrawButtonBackground(
27Rectangle bounds,
41return Rectangle.Inflate(bounds, -3, -3);
44public override void DrawFocusIndicator(Graphics g, Rectangle contentBounds, bool isDefault)
46Rectangle focus = Rectangle.Inflate(contentBounds, FocusIndicatorInflate, FocusIndicatorInflate);
85private void DrawButtonBorder(Graphics g, Rectangle bounds, PushButtonState state, bool isDefault)
96Rectangle outer = Rectangle.Inflate(bounds, -1, -1);
103Rectangle inner = Rectangle.Inflate(outer, -1, -1);
108private static void DrawSingleBorder(Graphics g, Rectangle rect, Color color, int thickness)
System\Windows\Forms\Controls\Buttons\ButtonInternal\DarkMode\SystemButtonDarkModeRenderer.cs (11)
35public override Rectangle DrawButtonBackground(
37Rectangle bounds,
68public override void DrawFocusIndicator(Graphics graphics, Rectangle contentBounds, bool isDefault)
141Rectangle bounds,
159Rectangle borderRect = Rectangle.Inflate(bounds, -SystemStylePadding, -SystemStylePadding);
223private static GraphicsPath GetTopLeftSegmentPath(Rectangle bounds, int radius)
230Rectangle arcRect = new(bounds.Location, new Size(diameter, diameter));
262private static GraphicsPath GetBottomRightSegmentPath(Rectangle bounds, int radius)
275Rectangle arcRect = new(bounds.Right - diameter, bounds.Bottom - diameter, diameter, diameter);
298private static RectangleF GetPathBounds(Rectangle bounds)
System\Windows\Forms\Controls\Buttons\ButtonRenderer.cs (36)
53public static void DrawParentBackground(Graphics g, Rectangle bounds, Control childControl)
56internal static void DrawParentBackground(IDeviceContext dc, Rectangle bounds, Control childControl)
65/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/>
66public static void DrawButton(Graphics g, Rectangle bounds, PushButtonState state) =>
69internal static void DrawButton(IDeviceContext deviceContext, Rectangle bounds, PushButtonState state)
88Rectangle bounds,
93Rectangle contentBounds;
111contentBounds = Rectangle.Inflate(bounds, -3, -3);
124/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/>
125public static void DrawButton(Graphics g, Rectangle bounds, bool focused, PushButtonState state) =>
128/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/>
129public static void DrawButton(Graphics g, Rectangle bounds, string? buttonText, Font? font, bool focused, PushButtonState state)
141/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/>
142public static void DrawButton(Graphics g, Rectangle bounds, string? buttonText, Font? font, TextFormatFlags flags, bool focused, PushButtonState state)
144Rectangle contentBounds;
158contentBounds = Rectangle.Inflate(bounds, -3, -3);
170/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/>
172public static void DrawButton(Graphics g, Rectangle bounds, Image image, Rectangle imageBounds, bool focused, PushButtonState state)
174Rectangle contentBounds;
188contentBounds = Rectangle.Inflate(bounds, -3, -3);
197/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/>
200Rectangle bounds,
204Rectangle imageBounds,
222Rectangle bounds,
227Rectangle imageBounds,
234Rectangle bounds,
239Rectangle imageBounds,
243Rectangle contentBounds;
269contentBounds = Rectangle.Inflate(bounds, -3, -3);
System\Windows\Forms\Controls\Buttons\CheckBoxRenderer.cs (21)
38/// <inheritdoc cref="ButtonRenderer.DrawParentBackground(Graphics, Rectangle, Control)"/>
39public static void DrawParentBackground(Graphics g, Rectangle bounds, Control childControl)
49/// <inheritdoc cref="DrawCheckBox(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, CheckBoxState)"/>
58Rectangle glyphBounds = new(glyphLocation, GetGlyphSize(g, state));
79Rectangle glyphBounds = new(glyphLocation, GetGlyphSize(hdc, state, hwnd));
83/// <inheritdoc cref="DrawCheckBox(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, CheckBoxState)"/>
87Rectangle textBounds,
101/// <inheritdoc cref="DrawCheckBox(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, CheckBoxState)"/>
105Rectangle textBounds,
115Rectangle textBounds,
123Rectangle glyphBounds = new(glyphLocation, GetGlyphSize(g, state, hwnd));
155/// <inheritdoc cref="DrawCheckBox(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, CheckBoxState)"/>
159Rectangle textBounds,
163Rectangle imageBounds,
183Rectangle textBounds,
188Rectangle imageBounds,
192Rectangle glyphBounds = new(glyphLocation, GetGlyphSize(g, state));
System\Windows\Forms\Controls\Buttons\RadioButtonRenderer.cs (23)
39/// <inheritdoc cref="ButtonRenderer.DrawParentBackground(Graphics, Rectangle, Control)"/>
40public static void DrawParentBackground(Graphics g, Rectangle bounds, Control childControl)
49/// <inheritdoc cref="DrawRadioButton(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, RadioButtonState)" />
60Rectangle glyphBounds = new(glyphLocation, GetGlyphSize(hdc, state, hwnd));
70Rectangle glyphBounds;
87/// <inheritdoc cref="DrawRadioButton(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, RadioButtonState)" />
91Rectangle textBounds,
102/// <inheritdoc cref="DrawRadioButton(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, RadioButtonState)" />
106Rectangle textBounds,
119Rectangle textBounds,
127Rectangle glyphBounds;
155/// <inheritdoc cref="DrawRadioButton(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, RadioButtonState)" />
159Rectangle textBounds,
163Rectangle imageBounds,
183Rectangle textBounds,
188Rectangle imageBounds,
206Rectangle textBounds,
211Rectangle imageBounds,
216Rectangle glyphBounds;
System\Windows\Forms\Controls\ComboBox\ComboBoxRenderer.cs (12)
30private static void DrawBackground(Graphics g, Rectangle bounds, ComboBoxState state)
41Rectangle fillRect = t_visualStyleRenderer.GetBackgroundContentRectangle(g, bounds);
52public static void DrawTextBox(Graphics g, Rectangle bounds, ComboBoxState state)
62public static void DrawTextBox(Graphics g, Rectangle bounds, string? comboBoxText, Font? font, ComboBoxState state)
70public static void DrawTextBox(Graphics g, Rectangle bounds, string? comboBoxText, Font? font, Rectangle textBounds, ComboBoxState state)
78public static void DrawTextBox(Graphics g, Rectangle bounds, string? comboBoxText, Font? font, TextFormatFlags flags, ComboBoxState state)
82Rectangle textBounds = t_visualStyleRenderer.GetBackgroundContentRectangle(g, bounds);
90public static void DrawTextBox(Graphics g, Rectangle bounds, string? comboBoxText, Font? font, Rectangle textBounds, TextFormatFlags flags, ComboBoxState state)
102public static void DrawDropDownButton(Graphics g, Rectangle bounds, ComboBoxState state)
115internal static void DrawDropDownButtonForHandle(HDC hdc, Rectangle bounds, ComboBoxState state, HWND hwnd)
System\Windows\Forms\Controls\DataGridView\DataGridView.Methods.cs (130)
2476Rectangle clip = Rectangle.Union(_layout.ColumnHeaders, _layout.Data);
2479clip = Rectangle.Union(_layout.TopLeftHeader, clip);
2500Rectangle cursorClip = _layout.ColumnHeaders;
2580private Rectangle GetResizeClipRectangle(int columnIndex)
2582Rectangle clip = Rectangle.Union(_layout.ColumnHeaders, _layout.Data);
2781Rectangle clip = Rectangle.Union(_layout.RowHeaders, _layout.Data);
2784clip = Rectangle.Union(_layout.TopLeftHeader, clip);
2816Rectangle clip = Rectangle.Union(_layout.RowHeaders, _layout.Data);
3024private Rectangle CalcColRelocationFeedbackRect(int mouseX)
3026Rectangle r, inside = _layout.ColumnHeaders;
3029inside = Rectangle.Union(_layout.TopLeftHeader, inside);
3056private Rectangle CalcColResizeFeedbackRect(int mouseX)
3058Rectangle inside = _layout.Data;
3059Rectangle r = new(
3077private Rectangle CalcRowResizeFeedbackRect(int mouseY)
3079Rectangle inside = _layout.Data;
3080Rectangle r = new(
3433private void CaptureMouse(Rectangle cursorClip)
4418Rectangle oldResizeRect = _layout.ResizeBoxRect;
4425Rectangle inside = newLayout.Inside;
4438Rectangle insideLeft = inside;
4443Rectangle colHeaders = insideLeft;
4452newLayout.ColumnHeaders = Rectangle.Empty;
4457Rectangle rowHeaders = insideLeft;
4474Rectangle topLeft;
4475Rectangle colHeaders = newLayout.ColumnHeaders;
4494newLayout.TopLeftHeader = Rectangle.Empty;
4499newLayout.RowHeaders = Rectangle.Empty;
4500newLayout.TopLeftHeader = Rectangle.Empty;
5481private RECT[]? CreateScrollableRegion(Rectangle scroll)
5541ref Rectangle rectScrollingArea,
5687Rectangle r = CalcColRelocationFeedbackRect(mouseX);
5691Rectangle rectInsertionBar = new(0, _layout.ColumnHeaders.Top, InsertionBarWidth, _layout.ColumnHeaders.Height);
5744Rectangle r = CalcColResizeFeedbackRect(mouseX);
5754Rectangle r = CalcRowResizeFeedbackRect(mouseY);
5758private void DrawShadowRect(Rectangle r)
5779private void DrawSplitBar(Rectangle r)
6127Invalidate(Rectangle.Union(_layout.TopLeftHeader, _layout.ColumnHeaders));
6480Rectangle rectScreen = Screen.FromControl(this).WorkingArea;
6873internal Rectangle GetCellAdjustedDisplayRectangle(int columnIndex, int rowIndex, bool cutOverflow)
6875Rectangle rect = GetCellDisplayRectangle(columnIndex, rowIndex, cutOverflow);
7099public Rectangle GetCellDisplayRectangle(int columnIndex, int rowIndex, bool cutOverflow)
7101Rectangle rowRect;
7102Rectangle columnRect;
8249public Rectangle GetColumnDisplayRectangle(int columnIndex, bool cutOverflow)
8257private Rectangle GetColumnDisplayRectanglePrivate(int columnIndex, bool cutOverflow)
8263return Rectangle.Empty;
8266Rectangle data = _layout.Data;
8360Rectangle columnRect = RightToLeftInternal
8373return Rectangle.Empty;
8380Rectangle data = _layout.Data;
8620Rectangle rectScrollingArea = _layout.Data;
8637rectScrollingArea = Rectangle.Union(rectScrollingArea, _layout.RowHeaders);
8729rectScrollingArea = Rectangle.Union(rectScrollingArea, _layout.ColumnHeaders);
9079public Rectangle GetRowDisplayRectangle(int rowIndex, bool cutOverflow)
9087private Rectangle GetRowDisplayRectanglePrivate(int rowIndex, bool cutOverflow)
9093return Rectangle.Empty;
9096Rectangle data = _layout.Data;
9147Rectangle rowRect = new(data.X, cy, data.Width, displayHeight);
9161return Rectangle.Empty;
9166Rectangle data = _layout.Data;
9850Rectangle cellDisplayRect = GetCellAdjustedDisplayRectangle(columnIndex, rowIndex, true);
9875Rectangle columnDisplayRect = GetColumnDisplayRectanglePrivate(columnIndex, true);
9919Rectangle rowDisplayRect = GetRowDisplayRectanglePrivate(rowIndex, true);
9952Rectangle rowDisplayRect, data;
10487Rectangle lastSplitBarRect = CalcRowResizeFeedbackRect(_lastRowSplitBar);
10548Invalidate(Rectangle.Union(_layout.TopLeftHeader, _layout.ColumnHeaders));
10555Rectangle lastSplitBarRect = CalcColResizeFeedbackRect(_lastColSplitBar);
13506Invalidate(Rectangle.Union(_layout.ColumnHeaders, _layout.Data));
13969Invalidate(Rectangle.Union(_layout.TopLeftHeader, _layout.ColumnHeaders));
14546Rectangle rightArea = _layout.Data;
14549rightArea = Rectangle.Union(rightArea, _layout.ColumnHeaders);
16743Rectangle clipRect = e.ClipRectangle;
16744Rectangle gridRect = GetGridRectangle();
16748clipRect = Rectangle.Union(clipRect, CalcRowResizeFeedbackRect(_currentRowSplitBar));
16752clipRect = Rectangle.Union(clipRect, CalcColResizeFeedbackRect(_currentColSplitBar));
16800private Rectangle GetGridRectangle()
16802Rectangle gridRect = _layout.Data;
16805gridRect = Rectangle.Union(gridRect, _layout.RowHeaders);
16819gridRect = Rectangle.Union(gridRect, _layout.ColumnHeaders);
16834private Rectangle GetGridFocusRectangle()
16836Rectangle focusRect = GetGridRectangle();
16848Rectangle focusRect = GetGridFocusRectangle();
16884private void InvalidateRectangleEdges(Rectangle rect)
16887Rectangle edge = rect;
17500Rectangle right;
17501Rectangle bottom;
17502Rectangle oldClientRectangle = _layout.ClientRectangle;
17503Rectangle oldGridFocusRectangle = GetGridFocusRectangle();
17520Rectangle newClientRectangle = _normalClientRectangle;
17521Rectangle newGridFocusRectangle = DisplayRectangle;
18249Invalidate(Rectangle.Union(_layout.TopLeftHeader, _layout.RowHeaders));
18882Rectangle rect = Screen.GetBounds(pt);
19266protected virtual void PaintBackground(Graphics graphics, Rectangle clipBounds, Rectangle gridBounds)
19269Rectangle rcBelowRows = gridBounds;
19295Rectangle rcNextRows = gridBounds;
19337private void PaintBorder(Graphics g, Rectangle clipRect, Rectangle bounds)
19349Rectangle edge = new(0, 0, bounds.Width, borderWidth);
19398private void PaintColumnHeaders(Graphics g, Rectangle clipBounds, bool singleBorderAdded)
19402Rectangle bandBounds, cellBounds;
19467Rectangle scrollingBounds = bandBounds;
19481Rectangle rowRect = bandBounds;
19552Rectangle gridBounds,
19553Rectangle clipRect,
19557Rectangle rc = gridBounds;
19572Rectangle columnHeadersClip = _layout.ColumnHeaders;
19616Rectangle boundingRect,
19617Rectangle clipRect,
19622Rectangle rowBounds;
19744Rectangle cellBounds = _layout.TopLeftHeader;
19869Rectangle editingZone = _layout.Data;
19885Rectangle cellBounds = new(leftEdge, GetRowYFromIndex(_ptCurrentCell.Y),
19887Rectangle cellClip = cellBounds;
25665Cursor.Clip = Rectangle.Empty;
25936Invalidate(Rectangle.Union(_layout.TopLeftHeader, _layout.ColumnHeaders));
26401Rectangle rowsRect = _layout.Data;
26404rowsRect = Rectangle.Union(rowsRect, _layout.RowHeaders);
29022Rectangle rectUpper = GetCellAdjustedDisplayRectangle(-1, rowIndexStart, true);
29023Rectangle rectLower = GetCellAdjustedDisplayRectangle(-1, rowIndexEnd, true);
29033Invalidate(Rectangle.Union(rectUpper, rectLower));
29072Rectangle bottomArea = _layout.Data;
29075bottomArea = Rectangle.Union(bottomArea, _layout.RowHeaders);
29147Rectangle bottomArea = _layout.Data;
29150bottomArea = Rectangle.Union(bottomArea, _layout.RowHeaders);
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (27)
27private static Rectangle s_rectThemeMargins = new(-1, -1, 0, 0);
149protected override Rectangle GetContentBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
155return Rectangle.Empty;
162out Rectangle cellBounds);
164Rectangle contentBounds = PaintPrivate(
214protected override Rectangle GetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
224return Rectangle.Empty;
231out Rectangle cellBounds);
233Rectangle errorIconBounds = PaintPrivate(
290Rectangle borderWidthsRect = StdBorderWidths;
306Rectangle rectThemeMargins = GetThemeMargins(graphics);
408private static Rectangle GetThemeMargins(Graphics g)
412Rectangle rectCell = new(0, 0, DATAGRIDVIEWBUTTONCELL_themeMargin, DATAGRIDVIEWBUTTONCELL_themeMargin);
413Rectangle rectContent = DataGridViewButtonCellRenderer.DataGridViewButtonRenderer.GetBackgroundContentRectangle(g, rectCell);
598Rectangle clipBounds,
599Rectangle cellBounds,
635private Rectangle PaintPrivate(
637Rectangle clipBounds,
638Rectangle cellBounds,
662Rectangle resultBounds;
675Rectangle valBounds = cellBounds;
676Rectangle borderWidths = BorderWidths(advancedBorderStyle);
684return Rectangle.Empty;
708Rectangle errorBounds = valBounds;
867resultBounds = Rectangle.Empty;
873resultBounds = Rectangle.Empty;
887ControlPaint.DrawFocusRectangle(g, Rectangle.Inflate(valBounds, -1, -1), Color.Empty, cellStyle.ForeColor);
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (45)
53private readonly List<Rectangle> _nonEmptyNeighbors;
105public Rectangle ContentBounds => GetContentBounds(RowIndex);
187public Rectangle ErrorIconBounds => GetErrorIconBounds(RowIndex);
283Rectangle IKeyboardToolTip.GetNativeScreenRectangle() => AccessibilityObject.Bounds;
294IList<Rectangle> IKeyboardToolTip.GetNeighboringToolsRectangles()
585private protected Rectangle StdBorderWidths
603return Rectangle.Empty;
821protected virtual Rectangle BorderWidths(DataGridViewAdvancedBorderStyle advancedBorderStyle)
825Rectangle rect = new Rectangle
948out Rectangle cellBounds)
1006internal Rectangle ComputeErrorIconBounds(Rectangle cellValueBounds)
1011Rectangle bmpRect = new(DataGridView!.RightToLeftInternal ?
1021return Rectangle.Empty;
1464public Rectangle GetContentBounds(int rowIndex)
1468return Rectangle.Empty;
1477protected virtual Rectangle GetContentBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) => Rectangle.Empty;
1531internal Rectangle GetErrorIconBounds(int rowIndex)
1538protected virtual Rectangle GetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex) => Rectangle.Empty;
2756Rectangle contentBounds = GetContentBounds(screen, dataGridViewCellStyle, rowIndex);
3071Rectangle clipBounds,
3072Rectangle cellBounds,
3086Rectangle clipBounds,
3087Rectangle cellBounds,
3123Rectangle clipBounds,
3124Rectangle bounds,
3528Rectangle clipBounds,
3529Rectangle cellValueBounds,
3547private static void PaintErrorIcon(Graphics graphics, Rectangle iconBounds)
3563Rectangle cellBounds,
3564Rectangle cellValueBounds,
3571Rectangle iconBounds = GetErrorIconBounds(graphics, cellStyle, rowIndex);
3593Rectangle bounds,
3598Rectangle rectPadding;
3633Rectangle clipBounds,
3634Rectangle cellBounds,
3751Rectangle cellBounds,
3752Rectangle cellClip,
3759Rectangle editingControlBounds = PositionEditingPanel(
3784public virtual Rectangle PositionEditingPanel(
3785Rectangle cellBounds,
3786Rectangle cellClip,
3808Rectangle borderAndPaddingWidths = BorderWidths(dgvabsEffective);
System\Windows\Forms\Controls\DataGridView\DataGridViewCheckBoxCell.cs (25)
444protected override Rectangle GetContentBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
450return Rectangle.Empty;
457out Rectangle cellBounds);
459Rectangle checkBoxBounds = PaintPrivate(
506protected override Rectangle GetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
516return Rectangle.Empty;
525return Rectangle.Empty;
532out Rectangle cellBounds);
534Rectangle errorIconBounds = PaintPrivate(
649Rectangle borderWidthsRect = StdBorderWidths;
734Rectangle borderWidths = BorderWidths(dgvabsEffective);
997Rectangle clipBounds,
998Rectangle cellBounds,
1039private Rectangle PaintPrivate(
1041Rectangle clipBounds,
1042Rectangle cellBounds,
1063Rectangle resultBounds;
1070Rectangle valBounds = cellBounds;
1071Rectangle borderWidths = BorderWidths(advancedBorderStyle);
1154Rectangle errorBounds = valBounds;
1287Rectangle checkBounds = new(checkBoxX, checkBoxY, checkBoxSize.Width, checkBoxSize.Height);
1345Rectangle fullSize = new(checkBoxX - 1, checkBoxY - 1, checkBoxSize.Width + 3, checkBoxSize.Height + 3);
1390Rectangle checkBounds = new(checkBoxX, checkBoxY, checkBoxSize.Width - 1, checkBoxSize.Height - 1);
1549resultBounds = Rectangle.Empty;
1555resultBounds = Rectangle.Empty;
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxCell.cs (33)
531Rectangle borderAndPaddingWidths = BorderWidths(dgvabsEffective);
728protected override Rectangle GetContentBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
734return Rectangle.Empty;
748out Rectangle cellBounds);
750Rectangle contentBounds = PaintPrivate(
831protected override Rectangle GetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
841return Rectangle.Empty;
851ComputeBorderStyleCellStateAndCellBounds(rowIndex, out DataGridViewAdvancedBorderStyle dgvabsEffective, out DataGridViewElementStates cellState, out Rectangle cellBounds);
853Rectangle errorIconBounds = PaintPrivate(
863out Rectangle dropDownButtonRect, // not used
1173Rectangle borderWidthsRect = StdBorderWidths;
1328Rectangle rectBottomSection = DataGridView.GetCellDisplayRectangle(ColumnIndex, rowIndex, true);
1760Rectangle cellBounds = DataGridView.GetCellDisplayRectangle(OwningColumn.Index, rowIndex, cutOverflow: false);
1771Rectangle dropDownButtonRect;
1811Rectangle clipBounds,
1812Rectangle cellBounds,
1852private Rectangle PaintPrivate(
1854Rectangle clipBounds,
1855Rectangle cellBounds,
1862out Rectangle dropDownButtonRect,
1880Rectangle resultBounds = Rectangle.Empty;
1881dropDownButtonRect = Rectangle.Empty;
1909Rectangle borderWidths = BorderWidths(advancedBorderStyle);
1910Rectangle valBounds = cellBounds;
2005Rectangle dropRect;
2205Rectangle errorBounds = valBounds;
2206Rectangle textBounds = Rectangle.Inflate(valBounds, -2, -2);
2254Rectangle focusBounds = textBounds;
2267Rectangle focusBounds = textBounds;
2353return Rectangle.Empty;
2366resultBounds = Rectangle.Empty;
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxCell.DataGridViewComboBoxCellRenderer.cs (5)
35public static void DrawTextBox(Graphics g, Rectangle bounds, ComboBoxState state)
40public static void DrawDropDownButton(Graphics g, Rectangle bounds, ComboBoxState state)
46public static void DrawBorder(Graphics g, Rectangle bounds)
60public static void DrawDropDownButton(Graphics g, Rectangle bounds, ComboBoxState state, bool rightToLeft)
79public static void DrawReadOnlyButton(Graphics g, Rectangle bounds, ComboBoxState state)
System\Windows\Forms\Controls\DataGridView\DataGridViewImageCell.cs (30)
225protected override Rectangle GetContentBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
231return Rectangle.Empty;
247out Rectangle cellBounds);
249Rectangle imgBounds = PaintPrivate(
287protected override Rectangle GetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
297return Rectangle.Empty;
313out Rectangle cellBounds);
315Rectangle errBounds = PaintPrivate(
409Rectangle borderWidthsRect = StdBorderWidths;
568private Rectangle ImageBounds(
569Rectangle bounds,
578Rectangle imageBounds = Rectangle.Empty;
679Rectangle clipBounds,
680Rectangle cellBounds,
716private Rectangle PaintPrivate(
718Rectangle clipBounds,
719Rectangle cellBounds,
743Rectangle resultBounds = Rectangle.Empty;
744Rectangle valBounds = cellBounds;
745Rectangle borderWidths = BorderWidths(advancedBorderStyle);
755? Rectangle.Empty
761return Rectangle.Empty;
765Rectangle imageBounds = valBounds;
794return Rectangle.Empty;
842Rectangle imageBounds2 = ImageBounds(
867g.SetClip(Rectangle.Intersect(
868Rectangle.Intersect(imageBounds2, imageBounds),
869Rectangle.Truncate(g.VisibleClipBounds)));
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (25)
183protected override Rectangle GetContentBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
189return Rectangle.Empty;
204out Rectangle cellBounds);
206Rectangle contentBounds = PaintPrivate(
242protected override Rectangle GetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
251return Rectangle.Empty;
258out Rectangle cellBounds);
269Rectangle errorBounds = PaintPrivate(
529Rectangle borderWidthsRect = BorderWidths(dgvabsEffective);
538Rectangle rectThemeMargins = GetThemeMargins(graphics);
575Rectangle clipBounds,
576Rectangle cellBounds,
612private Rectangle PaintPrivate(
614Rectangle clipBounds,
615Rectangle cellBounds,
638Rectangle resultBounds = Rectangle.Empty;
645Rectangle valBounds = cellBounds;
646Rectangle borderWidths = BorderWidths(advancedBorderStyle);
651Rectangle backgroundBounds = valBounds;
657return Rectangle.Empty;
715Rectangle rectThemeMargins = GetThemeMargins(graphics);
766Rectangle errorBounds = valBounds;
1024Rectangle bounds,
1033Rectangle bmpRect = new(width, height, s_iconsWidth, s_iconsHeight);
System\Windows\Forms\Controls\DataGridView\DataGridViewTextBoxCell.cs (24)
137private Rectangle GetAdjustedEditingControlBounds(Rectangle editingControlBounds, DataGridViewCellStyle cellStyle)
256protected override Rectangle GetContentBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
262return Rectangle.Empty;
278out Rectangle cellBounds);
280Rectangle textBounds = PaintPrivate(
323protected override Rectangle GetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
333return Rectangle.Empty;
340out Rectangle cellBounds);
342Rectangle errorBounds = PaintPrivate(graphics,
399Rectangle borderWidthsRect = StdBorderWidths;
597Rectangle clipBounds,
598Rectangle cellBounds,
639private Rectangle PaintPrivate(
641Rectangle clipBounds,
642Rectangle cellBounds,
664Rectangle resultBounds = Rectangle.Empty;
671Rectangle borderWidths = BorderWidths(advancedBorderStyle);
672Rectangle valBounds = cellBounds;
717Rectangle errorBounds = valBounds;
783Rectangle cellBounds,
784Rectangle cellClip,
791Rectangle editingControlBounds = PositionEditingPanel(
System\Windows\Forms\Controls\DataGridView\DataGridViewTopLeftHeaderCell.cs (21)
26protected override Rectangle GetContentBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
34return Rectangle.Empty;
45ComputeBorderStyleCellStateAndCellBounds(rowIndex, out DataGridViewAdvancedBorderStyle dgvabsEffective, out DataGridViewElementStates cellState, out Rectangle cellBounds);
47Rectangle contentBounds = PaintPrivate(
83protected override Rectangle GetErrorIconBounds(Graphics graphics, DataGridViewCellStyle cellStyle, int rowIndex)
89return Rectangle.Empty;
94ComputeBorderStyleCellStateAndCellBounds(rowIndex, out DataGridViewAdvancedBorderStyle dgvabsEffective, out DataGridViewElementStates cellState, out Rectangle cellBounds);
96Rectangle errorBounds = PaintPrivate(
145Rectangle borderWidthsRect = BorderWidths(DataGridView.AdjustedTopLeftHeaderBorderStyle);
167Rectangle clipBounds,
168Rectangle cellBounds,
204private Rectangle PaintPrivate(
206Rectangle clipBounds,
207Rectangle cellBounds,
230Rectangle resultBounds = Rectangle.Empty;
232Rectangle valBounds = cellBounds;
233Rectangle borderWidths = BorderWidths(advancedBorderStyle);
296Rectangle errorBounds = valBounds;
358Rectangle clipBounds,
359Rectangle bounds,
System\Windows\Forms\Controls\GroupBox\GroupBox.Modern.cs (34)
58private Rectangle ModernDisplayRectangle
172Rectangle clientBounds = ClientRectangle;
178Rectangle strokeBounds = clientBounds;
202private void DrawModernCard(PaintEventArgs e, Rectangle bounds)
207Rectangle frameBounds = new(
212Rectangle captionBounds = GetStandardCaptionBounds(
260private void PaintModernBackgroundImage(PaintEventArgs e, Rectangle clipBounds)
281private void DrawModernOutline(PaintEventArgs e, Rectangle bounds)
290Rectangle frameBounds = new(
296Rectangle captionBounds = GetFlatCaptionBounds(
315Rectangle captionBackground = GetFlatCaptionBackgroundBounds(
337private void DrawModernPopup(PaintEventArgs e, Rectangle bounds)
344Rectangle headerBounds = new(
350Rectangle captionBounds = GetPopupCaptionBounds(
421private Rectangle GetFlatCaptionBounds(
422Rectangle bounds,
442private Rectangle GetFlatCaptionBackgroundBounds(
444Rectangle captionBounds,
445Rectangle frameBounds)
447Rectangle textBounds = GetCaptionTextBounds(
452return Rectangle.Empty;
465? Rectangle.Empty
473private Rectangle GetPopupCaptionBounds(
474Rectangle bounds,
479Rectangle captionBounds = GetStandardCaptionBounds(
494Rectangle bounds,
519private GraphicsPath CreateModernFramePath(Rectangle bounds)
528private int GetModernFrameCornerRadius(Rectangle bounds)
541private Rectangle GetStandardCaptionBounds(
542Rectangle bounds,
640private Rectangle GetCaptionTextBounds(
642Rectangle availableBounds)
648return Rectangle.Empty;
676Rectangle bounds,
System\Windows\Forms\Controls\GroupBox\GroupBoxRenderer.cs (18)
50public static void DrawParentBackground(Graphics g, Rectangle bounds, Control childControl)
62public static void DrawGroupBox(Graphics g, Rectangle bounds, GroupBoxState state)
77public static void DrawGroupBox(Graphics g, Rectangle bounds, string? groupBoxText, Font? font, GroupBoxState state)
85Rectangle bounds,
97Rectangle bounds,
106Rectangle bounds,
127Rectangle bounds,
137Rectangle bounds,
157private static void DrawThemedGroupBoxNoText(Graphics g, Rectangle bounds, GroupBoxState state)
168Rectangle bounds,
178Rectangle textBounds = bounds;
205Rectangle boxBounds = bounds;
213Rectangle clipLeft = boxBounds;
214Rectangle clipMiddle = boxBounds;
215Rectangle clipRight = boxBounds;
246private static void DrawUnthemedGroupBoxNoText(Graphics g, Rectangle bounds)
274Rectangle bounds,
281Rectangle textBounds = bounds;
System\Windows\Forms\Controls\Labels\Label.cs (10)
871protected Rectangle CalcImageRenderBounds(Image image, Rectangle r, ContentAlignment align)
964private void DrawImage(PaintEventArgs e, Image image, Rectangle r, ContentAlignment align)
980protected void DrawImage(Graphics g, Image image, Rectangle r, ContentAlignment align)
983private void DrawImageInternal(Graphics g, Image image, Rectangle r, ContentAlignment align)
985Rectangle loc = CalcImageRenderBounds(image, r, align);
1252Rectangle face = LayoutUtils.DeflateRect(ClientRectangle, Padding);
1269Rectangle clientRect = ClientRectangle;
1349private protected override void PrintToMetaFileRecursive(HDC hDC, IntPtr lParam, Rectangle bounds)
1433Rectangle rectInScreen = RectangleToScreen(new Rectangle(0, 0, Width, Height));
System\Windows\Forms\Controls\Labels\LinkLabel.cs (14)
149private Rectangle ClientRectWithPadding => LayoutUtils.DeflateRect(ClientRectangle, Padding);
384internal static Rectangle CalcTextRenderBounds(Rectangle textRect, Rectangle clientRect, ContentAlignment align)
571Rectangle clientRectWithPadding = ClientRectWithPadding;
595Rectangle visualRectangle = new(
996Rectangle clientRect = ClientRectWithPadding;
1090focusRectangle = CalcTextRenderBounds(Rectangle.Round(focusRectangle), ClientRectWithPadding, RtlTranslateContent(TextAlign));
1145Rectangle clientRectWidthPadding = ClientRectWithPadding;
1166Rectangle imageBounds = CalcImageRenderBounds(image, ClientRectangle, RtlTranslateAlignment(ImageAlign));
1310Rectangle clientAreaMinusPadding = ClientRectWithPadding;
1336ControlPaint.DrawFocusRectangle(g, Rectangle.Ceiling(focusRectangle), ForeColor, BackColor);
1342ControlPaint.DrawFocusRectangle(g, Rectangle.Ceiling(rect), ForeColor, BackColor);
1374Rectangle clientRectWithPadding = ClientRectWithPadding;
System\Windows\Forms\Controls\ListView\ListView.cs (23)
2637Rectangle itemBounds = GetItemRectOrEmpty(itemIndex);
2723Rectangle subItemBounds = GetSubItemRect(itemIndex, nmcd->iSubItem);
3241Rectangle itemBounds = lvi.Bounds;
3247Rectangle iconBounds = GetItemRect(lvi.Index, ItemBoundsPortion.Icon);
3576public Rectangle GetItemRect(int index) => GetItemRect(index, 0);
3581public Rectangle GetItemRect(int index, ItemBoundsPortion portion)
3591return Rectangle.Empty;
3604: (Rectangle)itemrect;
3611private Rectangle GetItemRectOrEmpty(int index)
3615return Rectangle.Empty;
3620return Rectangle.Empty;
3629? Rectangle.Empty
3630: (Rectangle)itemrect;
3636internal Rectangle GetSubItemRect(int itemIndex, int subItemIndex)
3641internal Rectangle GetSubItemRect(int itemIndex, int subItemIndex, ItemBoundsPortion portion)
3645return Rectangle.Empty;
3667return Rectangle.Empty;
3681: (Rectangle)itemrect;
5062Rectangle rectInvalid = Items[startIndex].Bounds;
5065rectInvalid = Rectangle.Union(rectInvalid, Items[index].Bounds);
5070rectInvalid = Rectangle.Union(rectInvalid, Items[startIndex - 1].Bounds);
5081rectInvalid = Rectangle.Union(rectInvalid, Items[endIndex + 1].Bounds);
6977Rectangle rect = new(0, 0, Size.Width - 1, Size.Height - 1);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\GridEntry.cs (25)
46private Rectangle _outlineRect = Rectangle.Empty;
640public Rectangle OutlineRectangle
666_outlineRect = Rectangle.Empty;
1503Rectangle rect,
1504Rectangle clipRect,
1568Rectangle textRect = new(stringX, rect.Y + 1, maxSpace, rect.Height - 1);
1570if (!Rectangle.Intersect(textRect, clipRect).IsEmpty)
1621private void PaintOutlineGlyph(Graphics g, Rectangle r)
1632_outlineRect = Rectangle.Empty;
1647_outlineRect = Rectangle.Empty;
1655void PaintOutlineWithExplorerTreeStyle(Graphics g, Rectangle r, HWND hwnd)
1658Rectangle outline = Rectangle.Intersect(r, OutlineRectangle);
1698Rectangle rectangle,
1720void PaintOutlineWithClassicStyle(Graphics g, Rectangle r)
1723Rectangle outline = Rectangle.Intersect(r, OutlineRectangle);
1781Rectangle rect,
1782Rectangle clipRect,
1836Rectangle rectPaint = new(
1842if (!Rectangle.Intersect(rectPaint, clipRect).IsEmpty)
1879if (Rectangle.Intersect(rect, clipRect).IsEmpty)
1896Rectangle textRectangle = new(
1993Rectangle outlineRect = OutlineRectangle;
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (44)
83private Rectangle _lastClientRect = Rectangle.Empty;
478Rectangle rect = GetRectangle(_selectedRow, RowLabel);
614internal Rectangle AccessibilityGetGridEntryBounds(GridEntry gridEntry)
619return Rectangle.Empty;
622Rectangle rect = GetRectangle(row, RowValue | RowLabel);
628Rectangle parent = gridEntry.OwnerGrid.GridViewAccessibleObject.Bounds;
634return Rectangle.Empty;
698private static void AdjustOrigin(Graphics g, Point newOrigin, ref Rectangle r)
899private void CommonEditorUse(Control control, Rectangle targetRectangle)
903Rectangle rectCur = control.Bounds;
906Rectangle clientRect = ClientRectangle;
912targetRectangle = Rectangle.Intersect(clientRect, targetRectangle);
926targetRectangle = Rectangle.Empty;
1113Rectangle rect,
1116Rectangle clipRect)
1126clipRect = Rectangle.Intersect(rect, clipRect);
1171private void DrawValue(Graphics g, int row, Rectangle clipRect)
1179Rectangle rect = GetRectangle(row, RowValue);
1181clipRect = Rectangle.Intersect(clipRect, rect);
1392Rectangle r = GetRectangle(row, rowValue ? RowValue : RowLabel);
1446Rectangle rect = GetRectangle(_selectedRow, RowValue);
1449Rectangle rectScreen = Screen.FromControl(EditTextBox).WorkingArea;
1908public Rectangle GetRectangle(int row, int flRow)
1910Rectangle rect = new(0, 0, 0, 0);
1996Rectangle rect = ClientRectangle;
2001Rectangle boundsScroll = ScrollBar.Bounds;
2029Rectangle rect;
2144Rectangle r = ClientRectangle;
2324Rectangle drawBounds = e.Bounds;
2388Rectangle clearRect = new(1, 1, Size.Width - 2, Size.Height - 2);
3025Rectangle r = GetRectangle(pos.Y, RowLabel);
3099Rectangle itemRect = GetRectangle(point.Y, point.X);
3311Rectangle clipRect = e.ClipRectangle;
3377Rectangle rect = GetRectangle(i, RowLabel);
3400Rectangle clearRect = new(1, yPosition, Size.Width - 2, Size.Height - yPosition - 1);
3626Rectangle newRect = ClientRectangle;
3627int yDelta = _lastClientRect == Rectangle.Empty ? 0 : newRect.Height - _lastClientRect.Height;
3633Rectangle rectInvalidate = new(_lastClientRect.Width - 1, 0, newRect.Width - _lastClientRect.Width + 1, _lastClientRect.Height);
3639Rectangle rectInvalidate = new(0, _lastClientRect.Height - 1, _lastClientRect.Width, newRect.Height - _lastClientRect.Height + 1);
3827internal static void PositionTooltip(Control parent, GridToolTip toolTip, Rectangle itemRect)
4353Rectangle rect = GetRectangle(row, RowValue);
4372Rectangle rectTarget = new(
5307Rectangle itemRect = GetRectangle(mouseLoc.Y, mouseLoc.X);
System\Windows\Forms\Controls\TabControl\TabRenderer.cs (21)
27public static void DrawTabItem(Graphics g, Rectangle bounds, TabItemState state)
37public static void DrawTabItem(Graphics g, Rectangle bounds, bool focused, TabItemState state)
44Rectangle contentBounds = Rectangle.Inflate(bounds, -3, -3);
54public static void DrawTabItem(Graphics g, Rectangle bounds, string? tabItemText, Font? font, TabItemState state)
62public static void DrawTabItem(Graphics g, Rectangle bounds, string? tabItemText, Font? font, bool focused, TabItemState state)
72public static void DrawTabItem(Graphics g, Rectangle bounds, string? tabItemText, Font? font, TextFormatFlags flags, bool focused, TabItemState state)
78Rectangle contentBounds = Rectangle.Inflate(bounds, -3, -3);
91public static void DrawTabItem(Graphics g, Rectangle bounds, Image image, Rectangle imageRectangle, bool focused, TabItemState state)
98Rectangle contentBounds = Rectangle.Inflate(bounds, -3, -3);
111public static void DrawTabItem(Graphics g, Rectangle bounds, string? tabItemText, Font? font, Image image, Rectangle imageRectangle, bool focused, TabItemState state)
121public static void DrawTabItem(Graphics g, Rectangle bounds, string? tabItemText, Font? font, TextFormatFlags flags, Image image, Rectangle imageRectangle, bool focused, TabItemState state)
128Rectangle contentBounds = Rectangle.Inflate(bounds, -3, -3);
142public static void DrawTabPage(Graphics g, Rectangle bounds)
145internal static void DrawTabPage(IDeviceContext deviceContext, Rectangle bounds)
System\Windows\Forms\Controls\TextBox\TextBoxBase.cs (53)
996Rectangle bounds,
2750Rectangle bounds = new(
2758Rectangle nativeClientBounds = Rectangle.Intersect(bounds, GetNativeClientRectangle());
2759Rectangle protectedClientBounds = GetProtectedClientBounds(nativeClientBounds);
2760Rectangle[] scrollBarBounds = GetVisibleScrollBarRectangles(bounds);
2762Rectangle deflatedBounds = bounds;
2781Rectangle bufferBounds = bounds;
2876Rectangle[] nonClientBands = GetNonClientPaintBands(
2884foreach (Rectangle band in nonClientBands)
2907private static Rectangle[] GetNonClientPaintBands(Rectangle bounds, Rectangle clientBounds)
2910private static Rectangle GetProtectedClientBounds(Rectangle clientBounds)
2912? Rectangle.Inflate(clientBounds, -1, -1)
2915private static Rectangle[] GetNonClientPaintBands(
2916Rectangle bounds,
2917Rectangle clientBounds,
2918Rectangle[] additionalProtectedBounds)
2922return [Rectangle.Empty, Rectangle.Empty, Rectangle.Empty, Rectangle.Empty];
2925Rectangle protectedBounds = Rectangle.Intersect(bounds, clientBounds);
2927Rectangle[] initialBands = protectedBounds.Width <= 0 || protectedBounds.Height <= 0
2928? [bounds, Rectangle.Empty, Rectangle.Empty, Rectangle.Empty]
2930Rectangle.FromLTRB(bounds.Left, bounds.Top, bounds.Right, protectedBounds.Top),
2931Rectangle.FromLTRB(bounds.Left, protectedBounds.Bottom, bounds.Right, bounds.Bottom),
2932Rectangle.FromLTRB(bounds.Left, protectedBounds.Top, protectedBounds.Left, protectedBounds.Bottom),
2933Rectangle.FromLTRB(protectedBounds.Right, protectedBounds.Top, bounds.Right, protectedBounds.Bottom)
2941List<Rectangle> paintBands = [.. initialBands];
2943foreach (Rectangle additionalProtectedBoundsItem in additionalProtectedBounds)
2945Rectangle clippedProtectedBounds = Rectangle.Intersect(bounds, additionalProtectedBoundsItem);
2954Rectangle band = paintBands[i];
2955Rectangle intersection = Rectangle.Intersect(band, clippedProtectedBounds);
2963AddPaintBand(Rectangle.FromLTRB(band.Left, band.Top, band.Right, intersection.Top));
2964AddPaintBand(Rectangle.FromLTRB(band.Left, intersection.Bottom, band.Right, band.Bottom));
2965AddPaintBand(Rectangle.FromLTRB(band.Left, intersection.Top, intersection.Left, intersection.Bottom));
2966AddPaintBand(Rectangle.FromLTRB(intersection.Right, intersection.Top, band.Right, intersection.Bottom));
2972void AddPaintBand(Rectangle band)
2981private unsafe Rectangle[] GetVisibleScrollBarRectangles(Rectangle bounds)
2989List<Rectangle> scrollBarBounds = [];
3008Rectangle scrollBarRectangle = Rectangle.FromLTRB(
3022private Rectangle GetNativeClientRectangle()
3027return Rectangle.Empty;
System\Windows\Forms\Controls\TextBox\TextBoxRenderer.cs (10)
25private static void DrawBackground(Graphics g, Rectangle bounds, TextBoxState state)
33Rectangle fillRect = t_visualStyleRenderer.GetBackgroundContentRectangle(g, bounds);
42public static void DrawTextBox(Graphics g, Rectangle bounds, TextBoxState state)
51public static void DrawTextBox(Graphics g, Rectangle bounds, string? textBoxText, Font? font, TextBoxState state)
59public static void DrawTextBox(Graphics g, Rectangle bounds, string? textBoxText, Font? font, Rectangle textBounds, TextBoxState state)
67public static void DrawTextBox(Graphics g, Rectangle bounds, string? textBoxText, Font? font, TextFormatFlags flags, TextBoxState state)
70Rectangle textBounds = t_visualStyleRenderer.GetBackgroundContentRectangle(g, bounds);
78public static void DrawTextBox(Graphics g, Rectangle bounds, string? textBoxText, Font? font, Rectangle textBounds, TextFormatFlags flags, TextBoxState state)
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDownItem.cs (14)
116internal virtual Rectangle DropDownButtonArea => Bounds;
140Rectangle bounds = GetDropDownBounds(dropDownDirection);
141Rectangle ownerItemBounds = new(TranslatePoint(Point.Empty, ToolStripPointType.ToolStripItemCoords, ToolStripPointType.ScreenCoords), Size);
142Rectangle intersectionBetweenChildAndParent = Rectangle.Intersect(bounds, ownerItemBounds);
151int newIntersectionWidth = Rectangle.Intersect(GetDropDownBounds(newDropDownDirection), ownerItemBounds).Width;
300private Rectangle DropDownDirectionToDropDownBounds(ToolStripDropDownDirection dropDownDirection, Rectangle dropDownBounds)
379private Rectangle GetDropDownBounds(ToolStripDropDownDirection dropDownDirection)
381Rectangle dropDownBounds = new(Point.Empty, DropDown.GetSuggestedSize());
386Rectangle itemScreenBounds = new(TranslatePoint(Point.Empty, ToolStripPointType.ToolStripItemCoords, ToolStripPointType.ScreenCoords), Size);
388if (Rectangle.Intersect(dropDownBounds, itemScreenBounds).Height > 1)
393if (Rectangle.Intersect(dropDownBounds, itemScreenBounds).Width > 1)
399if (Rectangle.Intersect(dropDownBounds, itemScreenBounds).Width > 1)
System\Windows\Forms\Controls\ToolStrips\ToolstripProfessionalRenderer.cs (57)
165Rectangle overflowArrowRect;
230Rectangle bounds = new(Point.Empty, item.Size);
266Rectangle bounds = new(Point.Empty, item.Size);
269Rectangle fillRect = item.Selected ? item.ContentRectangle : bounds;
282Rectangle buttonBounds = item.ButtonBounds;
296Rectangle dropDownRect = item.DropDownButtonBounds;
346Rectangle bounds = new(Point.Empty, item?.Size ?? Size.Empty);
354Rectangle fillRect = item is not null && item.Selected ? item.ContentRectangle : bounds;
416Rectangle bounds = new(Point.Empty, toolStrip.Size);
453Rectangle edging;
482Rectangle bounds = e.GripBounds;
497Rectangle[] shadowRects = new Rectangle[numRectangles];
545Rectangle bounds = new(Point.Empty, item.Size);
591Rectangle fillRect = bounds;
648Rectangle fillRect = bounds;
696Rectangle bounds = e.AffectedBounds;
742Rectangle imageRect = e.ImageRectangle;
757if (imageRect != Rectangle.Empty && image is not null)
845Rectangle bounds = new(Point.Empty, toolStrip.Size);
859Rectangle topLeftParentHorizontalPixels = new(topLeft, s_onePix);
860Rectangle bottomLeftParentHorizontalPixels = new(bottomLeft, new Size(2, 1));
861Rectangle bottomLeftParentVerticalPixels = new(bottomLeft.X, bottomLeft.Y - 1, 1, 2);
864Rectangle bottomRightHorizontalPixels = new(bottomRight.X - 1, bottomRight.Y, 2, 1);
865Rectangle bottomRightVerticalPixels = new(bottomRight.X, bottomRight.Y - 1, 1, 2);
868Rectangle topRightHorizontalPixels, topRightVerticalPixels;
952private static void FillWithDoubleGradient(Color beginColor, Color middleColor, Color endColor, Graphics g, Rectangle bounds, int firstGradientWidth, int secondGradientWidth, LinearGradientMode mode, bool flipHorizontal)
959Rectangle endGradient = bounds;
960Rectangle beginGradient = bounds;
1044Rectangle bounds = ScaleHelper.IsScalingRequired
1078private void RenderPressedGradient(Graphics g, Rectangle bounds)
1107Rectangle bounds = new(Point.Empty, item.Size);
1109Rectangle fillRect = item.Selected ? item.ContentRectangle : bounds;
1140Rectangle gradientBounds = new(Point.Empty, parent.Size);
1154Rectangle gradientBounds = new(Point.Empty, control.Size);
1173Rectangle bounds = new(Point.Empty, e.ToolStrip.Size);
1182Rectangle bounds = new(Point.Empty, e.ToolStrip.Size);
1194Rectangle bounds = new(Point.Empty, toolStripDropDown.Size);
1216Rectangle overflowBoundsFill = new(Point.Empty, e.Item.Size);
1217Rectangle bounds = overflowBoundsFill;
1320Rectangle fillRect = new(overflowBoundsFill.X - 1, 0, 1, 1);
1337Rectangle bounds = new(Point.Empty, e.ToolStrip.Size);
1339Rectangle displayRect = toolStrip.DisplayRectangle;
1353Rectangle topLeftShadowRect = new(topLeft, s_onePix);
1357Rectangle topLeftShadowRect2 = new(topLeft, s_onePix);
1361Rectangle topRightShadowRect = new(topRight, s_onePix);
1365Rectangle topRightShadowRect2 = topRightShadowRect;
1369Rectangle[] paintRects = [topLeftShadowRect, topLeftShadowRect2, topRightShadowRect, topRightShadowRect2];
1376paintRects[i] = Rectangle.Empty;
1395Rectangle otherBottom = new(bottomLeft.X, bottomLeft.Y - 2, 1, 1);
1403private void RenderSelectedButtonFill(Graphics g, Rectangle bounds)
1427private void RenderCheckedButtonFill(Graphics g, Rectangle bounds)
1451private void RenderSeparatorInternal(Graphics g, ToolStripItem item, Rectangle bounds, bool vertical)
1539private void RenderPressedButtonFill(Graphics g, Rectangle bounds)
1566Rectangle bounds = new(Point.Empty, item.Size);
1569Rectangle fillRect = (item.Selected) ? item.ContentRectangle : bounds;
1645private static Point RenderArrowInternal(Graphics g, Rectangle dropDownRect, ArrowDirection direction, Brush brush)
System\Windows\Forms\Controls\ToolStrips\ToolStripSplitStackLayout.cs (24)
12private Rectangle _displayRectangle = Rectangle.Empty;
177_displayRectangle = Rectangle.Empty;
211Rectangle clientRectangle = toolStrip.ClientRectangle;
217Rectangle alignedLeftItems = Rectangle.Empty;
218Rectangle alignedRightItems = Rectangle.Empty;
301alignedRightItems = (alignedRightItems == Rectangle.Empty) ? new Rectangle(x, y, itemSize.Width, itemSize.Height)
302: Rectangle.Union(alignedRightItems, new Rectangle(x, y, itemSize.Width, itemSize.Height));
314alignedLeftItems = (alignedLeftItems == Rectangle.Empty) ? new Rectangle(x, y, itemSize.Width, itemSize.Height)
315: Rectangle.Union(alignedLeftItems, new Rectangle(x, y, itemSize.Width, itemSize.Height));
339Rectangle bounds = LayoutUtils.VAlign(item.Size, _displayRectangle, AnchorStyles.None);
357Rectangle clientRectangle = toolStrip.ClientRectangle;
362Rectangle alignedLeftItems = Rectangle.Empty;
363Rectangle alignedRightItems = Rectangle.Empty;
438alignedRightItems = (alignedRightItems == Rectangle.Empty) ? new Rectangle(x, y, itemSize.Width, itemSize.Height)
439: Rectangle.Union(alignedRightItems, new Rectangle(x, y, itemSize.Width, itemSize.Height));
446alignedLeftItems = (alignedLeftItems == Rectangle.Empty) ? new Rectangle(x, y, itemSize.Width, itemSize.Height)
447: Rectangle.Union(alignedLeftItems, new Rectangle(x, y, itemSize.Width, itemSize.Height));
472Rectangle bounds = LayoutUtils.HAlign(item.Size, _displayRectangle, AnchorStyles.None);
495Rectangle itemBounds = new(itemLocation, itemSize);
System\Windows\Forms\Controls\ToolStrips\ToolStripSystemRenderer.cs (18)
108private static void FillBackground(Graphics g, Rectangle bounds, Color backColor)
233Rectangle bounds = e.AffectedBounds;
290Rectangle bounds = toolStrip.ClientRectangle;
331Rectangle bounds = new(Point.Empty, e.GripBounds.Size);
474Rectangle bounds = new(Point.Empty, item.Size);
497Rectangle fillRect = new(Point.Empty, item.Size);
605Rectangle splitButtonBounds = splitButton.ButtonBounds;
622Rectangle fillRect = splitButton.ContentRectangle;
642var clientBounds = item.ClientBounds;
651Rectangle splitButtonButtonRect = splitButton.ButtonBounds;
655Rectangle bounds = new(Point.Empty, splitButton.Size);
658Rectangle fillRect = splitButton.Selected ? splitButton.ContentRectangle : bounds;
674Rectangle dropDownRect = splitButton.DropDownButtonBounds;
720var bounds = item.ClientBounds;
730Rectangle fillRect = item.ContentRectangle;
748private static void RenderSeparatorInternal(Graphics g, ToolStripItem item, Rectangle bounds, bool vertical)
803private static void RenderSmall3DBorderInternal(Graphics g, Rectangle bounds, ToolBarState state, bool rightToLeft)
852Rectangle fillRect = item.ContentRectangle;
System\Windows\Forms\Controls\TrackBar\TrackBarRenderer.cs (10)
28public static void DrawHorizontalTrack(Graphics g, Rectangle bounds)
38public static void DrawVerticalTrack(Graphics g, Rectangle bounds)
48public static void DrawHorizontalThumb(Graphics g, Rectangle bounds, TrackBarThumbState state)
58public static void DrawVerticalThumb(Graphics g, Rectangle bounds, TrackBarThumbState state)
68public static void DrawLeftPointingThumb(Graphics g, Rectangle bounds, TrackBarThumbState state)
78public static void DrawRightPointingThumb(Graphics g, Rectangle bounds, TrackBarThumbState state)
88public static void DrawTopPointingThumb(Graphics g, Rectangle bounds, TrackBarThumbState state)
98public static void DrawBottomPointingThumb(Graphics g, Rectangle bounds, TrackBarThumbState state)
108public static void DrawHorizontalTicks(Graphics g, Rectangle bounds, int numTicks, EdgeStyle edgeStyle)
138public static void DrawVerticalTicks(Graphics g, Rectangle bounds, int numTicks, EdgeStyle edgeStyle)
System\Windows\Forms\Controls\UpDown\UpDownBase.cs (22)
494internal override Rectangle ApplyBoundsConstraints(int suggestedX, int suggestedY, int proposedWidth, int proposedHeight)
612Rectangle editBounds = _upDownEdit.Bounds;
619Rectangle bounds = ClientRectangle;
620Rectangle clipBounds = e.ClipRectangle;
625Rectangle clipLeft = new(bounds.Left, bounds.Top, border, bounds.Height);
626Rectangle clipTop = new(bounds.Left, bounds.Top, bounds.Width, border);
627Rectangle clipRight = new(bounds.Right - border, bounds.Top, border, bounds.Height);
628Rectangle clipBottom = new(bounds.Left, bounds.Bottom - border, bounds.Width, border);
641Rectangle backRect = editBounds;
653Rectangle backRect = editBounds;
943Rectangle upDownEditBounds = Rectangle.Empty;
944Rectangle upDownButtonsBounds = Rectangle.Empty;
946Rectangle clientArea = LayoutUtils.DeflateRect(
1037Rectangle clientArea = LayoutUtils.DeflateRect(
1044Rectangle inner = clientArea;
1056Rectangle upDownEditBounds = inner;
1059Rectangle upDownButtonsBounds = new(
1088Rectangle bounds = ClientRectangle;
1107Rectangle deflatedBounds = bounds;
1214Rectangle focusBounds = ClientRectangle;
System\Windows\Forms\Form.cs (23)
154private Rectangle _restoredWindowBounds = new(-1, -1, -1, -1);
161private Rectangle _restoreBounds = new(-1, -1, -1, -1);
680Rectangle preClientUpdateRestoredWindowBounds = _restoredWindowBounds;
894public Rectangle DesktopBounds
898Rectangle screen = SystemInformation.WorkingArea;
899Rectangle bounds = Bounds;
921Rectangle screen = SystemInformation.WorkingArea;
1156protected Rectangle MaximizedBounds
1158get => Properties.GetValueOrDefault<Rectangle>(s_propMaximizedBounds);
1312Rectangle bounds = Bounds;
1663public Rectangle RestoreBounds
3110Rectangle bounds = Bounds;
3704Rectangle clientRect = mdiclient is null ? Rectangle.Empty : mdiclient.ClientRectangle;
3726Rectangle screenRect = desktop.WorkingArea;
3917Rectangle screenRect = desktop.WorkingArea;
3973Rectangle screenRect = desktop.WorkingArea;
5267protected override Rectangle GetScaledBounds(Rectangle bounds, SizeF factor, BoundsSpecified specified)
5459Rectangle workingArea = SystemInformation.WorkingArea;
5468Rectangle workingArea = SystemInformation.WorkingArea;
6933Rectangle maximizedBounds = MaximizedBounds;
6946private unsafe void WmGetMinMaxInfoHelper(ref Message m, Size minTrack, Size maxTrack, Rectangle maximizedBounds)
System\Windows\Forms\Input\Cursor.cs (8)
115/// Gets or sets a <see cref="Rectangle"/> that represents the current clipping
118public static unsafe Rectangle Clip
248private void DrawImageCore(Graphics graphics, Rectangle imageRect, Rectangle targetRect, bool stretch)
350public void Draw(Graphics g, Rectangle targetRect)
352DrawImageCore(g, Rectangle.Empty, targetRect, stretch: false);
358public void DrawStretched(Graphics g, Rectangle targetRect)
360DrawImageCore(g, Rectangle.Empty, targetRect, stretch: true);
System\Windows\Forms\Layout\DefaultLayout.cs (42)
31Rectangle bounds = GetCachedBounds(element);
47Rectangle newBounds = bounds;
77private static Rectangle GetGrowthBounds(IArrangedElement element, Size newSize)
80Rectangle oldBounds = GetCachedBounds(element);
98Rectangle newBounds = new(location, newSize);
149private static Rectangle GetAnchorDestination(IArrangedElement element, Rectangle displayRect, bool measureOnly)
157private static Rectangle ComputeAnchoredBoundsV2(IArrangedElement element, Rectangle displayRectangle)
159Rectangle bounds = GetCachedBounds(element);
236private static Rectangle ComputeAnchoredBounds(IArrangedElement element, Rectangle displayRect, bool measureOnly)
294Rectangle cachedBounds = GetCachedBounds(element);
351Rectangle displayRectangle = container.DisplayRectangle;
384Rectangle remainingBounds = measureOnly ? Rectangle.Empty : container.DisplayRectangle;
405Rectangle newElementBounds = new(remainingBounds.X, remainingBounds.Y, elementSize.Width, elementSize.Height);
418Rectangle newElementBounds = new(remainingBounds.X, remainingBounds.Bottom - elementSize.Height, elementSize.Width, elementSize.Height);
431Rectangle newElementBounds = new(remainingBounds.X, remainingBounds.Y, elementSize.Width, elementSize.Height);
444Rectangle newElementBounds = new(remainingBounds.Right - elementSize.Width, remainingBounds.Y, elementSize.Width, elementSize.Height);
462Rectangle newElementBounds = new(remainingBounds.X, remainingBounds.Y, elementSize.Width, elementSize.Height);
488private static void TryCalculatePreferredSizeDockedControl(IArrangedElement element, Rectangle newElementBounds, bool measureOnly, ref Size preferredSize, ref Rectangle remainingBounds)
737Rectangle cachedBounds = GetCachedBounds(element);
746Rectangle elementBounds = element.Bounds;
752Rectangle parentDisplayRect = element.Container.DisplayRectangle;
884Rectangle displayRectangle = control.Parent!.DisplayRectangle;
885Rectangle elementBounds = GetCachedBounds(control);
995Rectangle displayRect = element.Container!.DisplayRectangle;
1010private static Rectangle GetCachedBounds(IArrangedElement element)
1019return (Rectangle)bounds;
1035Rectangle displayRectangle = container.DisplayRectangle;
1066Rectangle bounds = (Rectangle)entry.Value!;
1079private static void SetCachedBounds(IArrangedElement element, Rectangle bounds)
1131Rectangle elementSpace = LayoutUtils.InflateRect(GetCachedBounds(element), margin);
1154Rectangle bounds = GetCachedBounds(element);
1159Rectangle anchorDest = GetAnchorDestination(element, Rectangle.Empty, measureOnly: true);
1170Rectangle anchorDest = GetAnchorDestination(element, Rectangle.Empty, measureOnly: true);
1174Rectangle bounds = GetCachedBounds(element);
System\Windows\Forms\Layout\FlowLayout.cs (8)
25Rectangle measureBounds = new(new Point(0, 0), proposedConstraints);
53private static Size TryCalculatePreferredSize(IArrangedElement container, Rectangle displayRect, bool measureOnly)
76Rectangle measureBounds = new(displayRect.X, displayRect.Y, displayRect.Width, displayRect.Height - layoutSize.Height);
86Rectangle rowBounds = new(displayRect.X,
117Rectangle rowBounds)
141Rectangle displayRectangle,
161Rectangle rowBounds,
226Rectangle cellBounds = new(location, new Size(requiredSize.Width, rowBounds.Height));
System\Windows\Forms\Layout\LayoutUtils.cs (43)
16public static readonly Rectangle s_maxRectangle = new(0, 0, int.MaxValue, int.MaxValue);
219public static bool IsIntersectHorizontally(Rectangle rect1, Rectangle rect2)
241public static bool IsIntersectVertically(Rectangle rect1, Rectangle rect2)
275public static Rectangle AlignAndStretch(Size fitThis, Rectangle withinThis, AnchorStyles anchorStyles)
280public static Rectangle Align(Size alignThis, Rectangle withinThis, AnchorStyles anchorStyles)
285public static Rectangle Align(Size alignThis, Rectangle withinThis, ContentAlignment align)
290public static Rectangle HAlign(Size alignThis, Rectangle withinThis, AnchorStyles anchorStyles)
306private static Rectangle HAlign(Size alignThis, Rectangle withinThis, ContentAlignment align)
322public static Rectangle VAlign(Size alignThis, Rectangle withinThis, AnchorStyles anchorStyles)
338public static Rectangle VAlign(Size alignThis, Rectangle withinThis, ContentAlignment align)
372public static Rectangle InflateRect(Rectangle rect, Padding padding)
381public static Rectangle DeflateRect(Rectangle rect, Padding padding)
440public static Rectangle FlipRectangle(Rectangle rect)
448public static Rectangle FlipRectangleIf(bool condition, Rectangle rect)
488public static bool IsZeroWidthOrHeight(Rectangle rectangle)
503public static void SplitRegion(Rectangle bounds, Size specifiedContent, AnchorStyles region1Align, out Rectangle region1, out Rectangle region2)
533Debug.Assert(Rectangle.Union(region1, region2) == bounds,
538public static void ExpandRegionsToFillBounds(Rectangle bounds, AnchorStyles region1Align, ref Rectangle region1, ref Rectangle region2)
567Debug.Assert(Rectangle.Union(region1, region2) == bounds, "region1 and region2 do not add up to bounds.");
589private static Rectangle SubstituteSpecifiedBounds(Rectangle originalBounds, Rectangle substitutionBounds, AnchorStyles specified)
595return Rectangle.FromLTRB(left, top, right, bottom);
601public static Rectangle RTLTranslate(Rectangle bounds, Rectangle withinBounds)
System\Windows\Forms\Layout\TableLayout.cs (6)
1250Rectangle cellBounds = new((int)(startX + cellBorderWidth / 2.0f), (int)(top + cellBorderWidth / 2.0f), width - cellBorderWidth, height - cellBorderWidth);
1268Rectangle elementBounds = LayoutUtils.AlignAndStretch(GetElementSize(element, cellBounds.Size), cellBounds, anchorStyles);
1474Rectangle elementBounds1 = layoutInfo1.Element.Bounds;
1475Rectangle cellsOccupied1 = new(layoutInfo1.ColumnStart, layoutInfo1.RowStart, layoutInfo1.ColumnSpan, layoutInfo1.RowSpan);
1479Rectangle elementBounds2 = layoutInfo2.Element.Bounds;
1480Rectangle cellsOccupied2 = new(layoutInfo2.ColumnStart, layoutInfo2.RowStart, layoutInfo2.ColumnSpan, layoutInfo2.RowSpan);
System\Windows\Forms\Printing\PrintPreviewControl.cs (14)
374Rectangle rect = InsideRectangle;
445private Rectangle InnerClientRectangle
449Rectangle rect = ClientRectangle;
458private Rectangle InsideRectangle
462Rectangle rect = InnerClientRectangle;
483private Rectangle FocusRectangle => new(0, 0, Width - 1, Height - 1);
485private Rectangle ResizeBoxRectangle => new(_vScrollBar.Left, _hScrollBar.Top, _vScrollBar.Width, _hScrollBar.Height);
614private void DrawMessage(Graphics g, Rectangle rect, bool isExceptionPrinting)
635private void DrawPages(Graphics g, Rectangle rect, PreviewPageInfo[] pages, Brush backBrush)
655Rectangle[] pageRenderArea = new Rectangle[_rows * _columns];
706Rectangle box = pageRenderArea[i];
741Rectangle focusRect = FocusRectangle;
816Rectangle availableRect = InnerClientRectangle;
System\Windows\Forms\Rendering\Button\PopupButtonKeyCapRenderer.cs (72)
45Action<Rectangle>? paintImage = null,
46(Rectangle TextBounds, Rectangle ImageBounds)? contentLayout = null,
47Action<Rectangle>? paintBackgroundImage = null)
52Rectangle bounds = context.Bounds;
84(Rectangle textBounds, Rectangle imageBounds) = contentLayout
120internal static Rectangle GetContentBounds(PopupButtonRenderContext context)
128Rectangle contentBounds = Rectangle.Inflate(
161Rectangle outer = metrics.KeyRect;
165Rectangle inner = metrics.KeyRect;
194Rectangle bowl = metrics.BowlRect;
226Rectangle topRect = bowl with { Height = topHeight };
238Rectangle bottomRect = new(bowl.Left, bowl.Bottom - bottomHeight, bowl.Width, bottomHeight);
256InflateForGradient(Rectangle.Inflate(bowl, 1, 1)),
282Rectangle.Round(borderRect),
298Rectangle focusRect = Rectangle.Inflate(metrics.KeyRect, -inset, -inset);
320Rectangle textRect)
350Rectangle outlineRect = textRect;
376Rectangle reliefRect = textRect;
383Rectangle upperRect = textRect;
402Action<Rectangle>? paintBackgroundImage)
412Rectangle backgroundBounds = Rectangle.Inflate(
434Action<Rectangle>? paintImage,
435(Rectangle TextBounds, Rectangle ImageBounds)? contentLayout,
436Action<Rectangle>? paintBackgroundImage)
438Rectangle bounds = context.Bounds;
445Rectangle contentRect = GetContentBounds(context);
460Rectangle borderRect = bounds;
469(Rectangle textRect, Rectangle imageRect) = contentLayout
486Rectangle focusRect = Rectangle.Inflate(bounds, -(int)(3 * scale), -(int)(3 * scale));
503private static (Rectangle TextBounds, Rectangle ImageBounds) CreateContentLayout(
505Rectangle contentBounds,
511contentBounds = Rectangle.Inflate(contentBounds, -inset, -inset);
523return (hasText ? contentBounds : Rectangle.Empty, Rectangle.Empty);
533hasText ? contentBounds : Rectangle.Empty,
551(Rectangle TextBounds, Rectangle ImageBounds) CreateHorizontalLayout(bool imageFirst)
554Rectangle imageSlot = imageFirst
557Rectangle textBounds = imageFirst
558? Rectangle.FromLTRB(imageSlot.Right + gap, contentBounds.Top, contentBounds.Right, contentBounds.Bottom)
559: Rectangle.FromLTRB(contentBounds.Left, contentBounds.Top, imageSlot.Left - gap, contentBounds.Bottom);
566(Rectangle TextBounds, Rectangle ImageBounds) CreateVerticalLayout(bool imageFirst)
569Rectangle imageSlot = imageFirst
572Rectangle textBounds = imageFirst
573? Rectangle.FromLTRB(contentBounds.Left, imageSlot.Bottom + gap, contentBounds.Right, contentBounds.Bottom)
574: Rectangle.FromLTRB(contentBounds.Left, contentBounds.Top, contentBounds.Right, imageSlot.Top - gap);
582private static Rectangle AlignInRectangle(
583Rectangle container,
610private static GraphicsPath CreateRoundedPath(Rectangle rect, float radius)
638private static Rectangle ApplyPadding(Rectangle rect, Padding padding)
649private static Rectangle InflateForGradient(Rectangle rect)
651Rectangle result = Rectangle.Inflate(rect, 1, 1);
729public Rectangle KeyRect { get; init; }
730public Rectangle BowlRect { get; init; }
742Rectangle bounds = context.Bounds;
757Rectangle keyRect = new(
779Rectangle bowlRect = Rectangle.Inflate(keyRect, -bowlInset, -bowlInset);
783bowlRect = Rectangle.Inflate(keyRect, -1, -1);
System\Windows\Forms\Rendering\CheckBox\AnimatedToggleSwitchRenderer.cs (21)
82Rectangle contentBounds = ToggleSwitchMetrics.GetContentBounds(Control);
83Rectangle switchBounds = GetSwitchBounds(
88Rectangle textBounds = GetTextBounds(
106Rectangle focusBounds = Rectangle.Inflate(Control.ClientRectangle, -1, -1);
142internal static Rectangle GetSwitchBounds(
155private static Rectangle GetSwitchBounds(
161Rectangle contentBounds = ToggleSwitchMetrics.GetContentBounds(control);
176internal static Rectangle GetTextBounds(
183Rectangle contentBounds = ToggleSwitchMetrics.GetContentBounds(control);
184Rectangle switchBounds = GetSwitchBounds(control, checkAlign, metrics, textSize);
188private static Rectangle GetTextBounds(
189Rectangle contentBounds,
190Rectangle switchBounds,
205return Rectangle.FromLTRB(contentBounds.Left, contentBounds.Top, right, contentBounds.Bottom);
212return Rectangle.FromLTRB(left, contentBounds.Top, contentBounds.Right, contentBounds.Bottom);
227Rectangle textBounds,
268private void RenderSwitch(Graphics graphics, Rectangle rect, ToggleSwitchMetrics metrics)
416Rectangle clipRectangle = Rectangle.Ceiling(graphics.ClipBounds);
522internal static Rectangle GetContentBounds(Control control)
System\Windows\Forms\Rendering\ControlPaint_ModernControlButtonRenderer.cs (7)
22Rectangle bounds,
129Rectangle focusRect = bounds;
159Rectangle bounds,
221private static int ScaleSymbolSize(Rectangle bounds, double contentScaleOverride)
240private static void DrawUpDownArrows(Graphics graphics, Brush brush, int centerX, int centerY, Rectangle bounds, double contentScaleOverride)
268private static void DrawLeftRightArrows(Graphics graphics, Brush brush, int centerX, int centerY, Rectangle bounds, double contentScaleOverride)
296private static void DrawEllipseSymbol(Graphics graphics, Brush brush, int centerX, int centerY, Rectangle bounds, double contentScaleOverride)
System\Windows\Forms\Rendering\ControlPaint.cs (56)
98internal static Rectangle CalculateBackgroundImageRectangle(Rectangle bounds, Size imageSize, ImageLayout imageLayout)
100Rectangle result = bounds;
419internal static void PrintBorder(Graphics graphics, Rectangle bounds, BorderStyle style, Border3DStyle b3dStyle)
444Rectangle bounds,
445Rectangle clipRect,
477Rectangle imageRectangle = CalculateBackgroundImageRectangle(bounds, backgroundImage.Size, backgroundImageLayout);
506Rectangle imageRect = imageRectangle;
508Rectangle partOfImageToDraw = new(Point.Empty, imageRect.Size);
520Rectangle imageRect = imageRectangle;
522Rectangle partOfImageToDraw = new(
553public static void DrawBorder(Graphics graphics, Rectangle bounds, Color color, ButtonBorderStyle style)
581Rectangle bounds,
600Rectangle bounds,
1008public static void DrawBorder3D(Graphics graphics, Rectangle rectangle)
1018public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style)
1029public static void DrawBorder3D(Graphics graphics, Rectangle rectangle, Border3DStyle style, Border3DSide sides)
1087private static void DrawBorderComplex(Graphics graphics, Rectangle bounds, Color color, ButtonBorderStyle style)
1174Rectangle bounds,
1211public static void DrawButton(Graphics graphics, Rectangle rectangle, ButtonState state)
1233Rectangle rectangle,
1259public static void DrawCheckBox(Graphics graphics, Rectangle rectangle, ButtonState state)
1287public static void DrawComboButton(Graphics graphics, Rectangle rectangle, ButtonState state)
1305public static void DrawContainerGrabHandle(Graphics graphics, Rectangle bounds)
1349private static void DrawFlatCheckBox(Graphics graphics, Rectangle rectangle, ButtonState state)
1371Rectangle rectangle,
1380Rectangle offsetRectangle = new(
1425public static void DrawFocusRectangle(Graphics graphics, Rectangle rectangle)
1432public static void DrawFocusRectangle(Graphics graphics, Rectangle rectangle, Color foreColor, Color backColor)
1435internal static void DrawHighContrastFocusRectangle(Graphics graphics, Rectangle rectangle, Color color)
1438internal static void DrawBlackWhiteFocusRectangle(Graphics graphics, Rectangle rectangle, Color color)
1441private static void DrawFocusRectangle(Graphics graphics, Rectangle rectangle, Color color, bool highContrast, bool blackAndWhite = false)
1511public static void DrawGrabHandle(Graphics graphics, Rectangle rectangle, bool primary, bool enabled)
1523Rectangle fillRect = new(
1538public static void DrawGrid(Graphics graphics, Rectangle area, Size pixelsBetweenDots, Color backColor)
1583Rectangle destination,
1605internal static void DrawImageReplaceColor(Graphics g, Image image, Rectangle dest, Color oldColor, Color newColor)
1625internal static void DrawImageDisabled(Graphics graphics, Image image, Rectangle imageBounds, bool unscaledImage)
1691internal static void EnforceHeaderCellDividerContrast(Graphics graphics, Rectangle bounds)
1708public static void DrawLockedFrame(Graphics graphics, Rectangle rectangle, bool primary)
1726public static void DrawMenuGlyph(Graphics graphics, Rectangle rectangle, MenuGlyph glyph)
1735Rectangle rectangle,
1771public static void DrawMixedCheckBox(Graphics graphics, Rectangle rectangle, ButtonState state)
1788public static void DrawRadioButton(Graphics graphics, Rectangle rectangle, ButtonState state)
1810public static void DrawReversibleFrame(Rectangle rectangle, Color backColor, FrameStyle style)
1870public static void DrawScrollButton(Graphics graphics, Rectangle rectangle, ScrollButton button, ButtonState state)
1892Rectangle bounds = new(x, y, width, height);
1930Rectangle outsideRect,
1931Rectangle insideRect,
1947public static void DrawSizeGrip(Graphics graphics, Color backColor, Rectangle bounds)
2041Rectangle layoutRectangle,
2058Rectangle layoutRectangle,
2081public static void DrawVisualStyleBorder(Graphics graphics, Rectangle bounds)
2095public static void FillReversibleRectangle(Rectangle rectangle, Color backColor)
2376Rectangle bound)
2409internal static void PaintTableCellBorder(TableLayoutPanelCellBorderStyle borderStyle, Graphics g, Rectangle bound)
System\Windows\Forms\Rendering\TextRenderer.cs (18)
149public static void DrawText(IDeviceContext dc, string? text, Font? font, Rectangle bounds, Color foreColor)
158/// <param name="bounds">The <see cref="Rectangle"/> that represents the bounds of the text.</param>
165Rectangle bounds,
173Rectangle bounds,
185/// <param name="bounds">The <see cref="Rectangle"/> that represents the bounds of the text.</param>
193Rectangle bounds,
202Rectangle bounds,
214/// <param name="bounds">The <see cref="Rectangle"/> that represents the bounds of the text.</param>
225Rectangle bounds,
241Rectangle bounds,
254/// <param name="bounds">The <see cref="Rectangle"/> that represents the bounds of the text.</param>
266Rectangle bounds,
293Rectangle bounds,
316Rectangle bounds,
325Rectangle bounds,
349Rectangle bounds,
359Rectangle bounds,
392/// <see cref="DrawText(IDeviceContext, ReadOnlySpan{char}, Font?, Rectangle, Color, TextFormatFlags)"/>
System\Windows\Forms\Scrolling\ScrollBarRenderer.cs (10)
27public static void DrawArrowButton(Graphics g, Rectangle bounds, ScrollBarArrowButtonState state)
37public static void DrawHorizontalThumb(Graphics g, Rectangle bounds, ScrollBarState state)
47public static void DrawVerticalThumb(Graphics g, Rectangle bounds, ScrollBarState state)
57public static void DrawHorizontalThumbGrip(Graphics g, Rectangle bounds, ScrollBarState state)
67public static void DrawVerticalThumbGrip(Graphics g, Rectangle bounds, ScrollBarState state)
77public static void DrawRightHorizontalTrack(Graphics g, Rectangle bounds, ScrollBarState state)
87public static void DrawLeftHorizontalTrack(Graphics g, Rectangle bounds, ScrollBarState state)
97public static void DrawUpperVerticalTrack(Graphics g, Rectangle bounds, ScrollBarState state)
107public static void DrawLowerVerticalTrack(Graphics g, Rectangle bounds, ScrollBarState state)
117public static void DrawSizeBox(Graphics g, Rectangle bounds, ScrollBarSizeBoxState state)
System\Windows\Forms\VisualStyles\VisualStyleRenderer.cs (33)
211public void DrawBackground(IDeviceContext dc, Rectangle bounds)
219internal unsafe void DrawBackground(HDC dc, Rectangle bounds, HWND hwnd = default)
240public void DrawBackground(IDeviceContext dc, Rectangle bounds, Rectangle clipRectangle)
248internal unsafe void DrawBackground(HDC dc, Rectangle bounds, Rectangle clipRectangle, HWND hwnd)
267public Rectangle DrawEdge(IDeviceContext dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects)
275internal unsafe Rectangle DrawEdge(HDC dc, Rectangle bounds, Edges edges, EdgeStyle style, EdgeEffects effects)
299public void DrawImage(Graphics g, Rectangle bounds, Image image)
314public void DrawImage(Graphics g, Rectangle bounds, ImageList imageList, int imageIndex)
335public void DrawParentBackground(IDeviceContext dc, Rectangle bounds, Control childControl)
355public void DrawText(IDeviceContext dc, Rectangle bounds, string? textToDraw)
363public void DrawText(IDeviceContext dc, Rectangle bounds, string? textToDraw, bool drawDisabled)
371public void DrawText(IDeviceContext dc, Rectangle bounds, string? textToDraw, bool drawDisabled, TextFormatFlags flags)
379internal void DrawText(HDC dc, Rectangle bounds, string? textToDraw, bool drawDisabled, TextFormatFlags flags)
405public Rectangle GetBackgroundContentRectangle(IDeviceContext dc, Rectangle bounds)
413internal Rectangle GetBackgroundContentRectangle(HDC dc, Rectangle bounds)
417return Rectangle.Empty;
427public Rectangle GetBackgroundExtent(IDeviceContext dc, Rectangle contentBounds)
433return Rectangle.Empty;
446public unsafe Region? GetBackgroundRegion(IDeviceContext dc, Rectangle bounds)
598public unsafe Size GetPartSize(IDeviceContext dc, Rectangle bounds, ThemeSizeType type)
658public unsafe Rectangle GetTextExtent(IDeviceContext dc, string textToDraw, TextFormatFlags flags)
681public unsafe Rectangle GetTextExtent(IDeviceContext dc, Rectangle bounds, string textToDraw, TextFormatFlags flags)
716public HitTestCode HitTestBackground(IDeviceContext dc, Rectangle backgroundRectangle, Point pt, HitTestOptions options)
738public HitTestCode HitTestBackground(Graphics g, Rectangle backgroundRectangle, Region region, Point pt, HitTestOptions options)
750public HitTestCode HitTestBackground(IDeviceContext dc, Rectangle backgroundRectangle, IntPtr hRgn, Point pt, HitTestOptions options)