System\Windows\Forms\Controls\ComboBox\ComboBox.cs (5)
381return new Size(121, PreferredHeight);
663set => base.MaximumSize = new Size(value.Width, 0);
669set => base.MinimumSize = new Size(value.Width, 0);
774Size textSize = TextRenderer.MeasureText(LayoutUtils.TestString, Font, new Size(short.MaxValue, (int)(FontHeight * 1.25)), TextFormatFlags.SingleLine);
785Size textSize = TextRenderer.MeasureText(LayoutUtils.TestString, Font, new Size(short.MaxValue, (int)(FontHeight * 1.25)), TextFormatFlags.SingleLine);
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (14)
1287ScaleHelper.GetIconResourceAsBitmap(typeof(DataGridViewCell), bitmapName, new Size(s_iconsWidth, s_iconsHeight));
2290return GetPreferredSize(screen, dataGridViewCellStyle, rowIndex, new Size(width, 0)).Height;
2297return new Size(-1, -1);
2309Size constraintSize) => new(-1, -1);
2345return GetPreferredSize(screen, dataGridViewCellStyle, rowIndex, new Size(0, height)).Width;
2352return new Size(-1, -1);
2362return new Size(OwningColumn.Thickness, OwningRow.GetHeight(rowIndex));
2552Size requiredSize = TextRenderer.MeasureText(text, font, new Size(maxWidth, int.MaxValue), flags);
2576return new Size(0, 0);
2591textSize = TextRenderer.MeasureText(text, font, new Size((int)maxWidth, int.MaxValue), flags);
2620return TextRenderer.MeasureText(text, font, new Size(int.MaxValue, int.MaxValue), flags);
2647textSize = TextRenderer.MeasureText(text, font, new Size((int)maxWidth, maxHeight), flags);
3772DataGridView.EditingControl.Size = new Size(editingControlBounds.Width, editingControlBounds.Height);
3858DataGridView.EditingPanel.Size = new Size(wEditingPanel, hEditingPanel);
System\Windows\Forms\Controls\DataGridView\DataGridViewImageCell.cs (10)
403return new Size(-1, -1);
435preferredSize = new Size(0, Math.Min(img.Height, decimal.ToInt32((decimal)img.Height * imgWidthAllowed / img.Width)));
447preferredSize = new Size(0, Math.Min(ico.Height, decimal.ToInt32((decimal)ico.Height * icoWidthAllowed / ico.Width)));
453preferredSize = new Size(0, 1);
470preferredSize = new Size(Math.Min(img.Width, decimal.ToInt32((decimal)img.Width * imgHeightAllowed / img.Height)), 0);
482preferredSize = new Size(Math.Min(ico.Width, decimal.ToInt32((decimal)ico.Width * icoHeightAllowed / ico.Height)), 0);
488preferredSize = new Size(1, 0);
495preferredSize = new Size(img.Width, img.Height);
499preferredSize = new Size(ico.Width, ico.Height);
503preferredSize = new Size(1, 1);
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\GridErrorDialog.cs (11)
130Size = new(208, 43),
138Size = new(64, 64),
151Size = new(100, 23),
163Size = new(75, 23),
176Size = new(75, 23),
190Size = new(290, 29),
213Size = new(284, 73),
230Size = new(290, 108),
231MinimumSize = new(279, 50),
255Size = new(273, 100),
269ClientSize = new(299, 113);
System\Windows\Forms\Form.cs (6)
449return new Size((int)Math.Round(real.Width), (int)Math.Round(real.Height));
886protected override Size DefaultSize => new Size(300, 300);
1243Size = new Size(Math.Min(size.Width, value.Width), Math.Min(size.Height, value.Height));
1360Size = new Size(Math.Max(size.Width, value.Width), Math.Max(size.Height, value.Height));
2984Size newVar = new((int)Math.Round(newVarF.Width), (int)Math.Round(newVarF.Height));
4480_dpiFormSizes.Add(e.DeviceDpiNew, new Size(e.SuggestedRectangle.Width, e.SuggestedRectangle.Height));
System\Windows\Forms\Layout\CommonProperties.cs (6)
32internal static Size DefaultMinimumSize { get; } = new(0, 0);
33internal static Size DefaultMaximumSize { get; } = new(0, 0);
200Debug.Assert(value != GetMaximumSize(element, new Size(-7109, -7107)),
214Debug.Assert(GetMaximumSize(element, new Size(-7109, -7107)) == value, "Error detected setting MaximumSize.");
222Debug.Assert(value != GetMinimumSize(element, new Size(-7109, -7107)),
236Debug.Assert(GetMinimumSize(element, new Size(-7109, -7107)) == value, "Error detected setting MinimumSize.");
System\Windows\Forms\Layout\Containers\SplitContainer.cs (15)
328return new Size(150, 100);
1601Panel1.Size = new Size(0, Panel1.Height);
1602Panel2.Size = new Size(0, Panel2.Height);
1607Panel1.Size = new Size(Panel1.Width, 0);
1608Panel2.Size = new Size(Panel2.Width, 0);
1619Panel1.Size = new Size(_panelSize, Height);
1620Panel2.Size = new Size(Math.Max(Width - _panelSize - SplitterWidthInternal, Panel2MinSize), Height);
1625Panel2.Size = new Size(_panelSize, Height);
1640Panel2.Size = new Size(Math.Max(Width - _splitterDistance - SplitterWidthInternal, Panel2MinSize), Height);
1677Panel1.Size = new Size(Width, _panelSize);
1679Panel2.Size = new Size(Width, Math.Max(Height - panel2Start, Panel2MinSize));
1685Panel2.Size = new Size(Width, _panelSize);
1704Panel2.Size = new Size(Width, Math.Max(Height - panel2Start, Panel2MinSize));
2178Panel2.Size = new Size(Width - _splitterDistance - SplitterWidthInternal, Height);
2228Panel2.Size = new Size(Width, Height - panel2Start);
System\Windows\Forms\Layout\TableLayout.cs (7)
105Size containerSize = container.DisplayRectangle.Size - new Size(cellBorderWidth, cellBorderWidth);
119CommonProperties.SetLayoutBounds(containerInfo.Container, new Size(SumStrips(containerInfo.Columns, 0, containerInfo.Columns.Length),
162Size containerSize = container.DisplayRectangle.Size - new Size(cellBorderWidth * 2, cellBorderWidth * 2);
176Size cellBorderSize = new(cellBorderWidth, cellBorderWidth);
726minWidth = GetElementSize(element, new Size(0, constrainingHeight)).Width;
731minWidth = GetElementSize(element, new Size(1, 0)).Width;
856int minHeight = GetElementSize(element, new Size(currentWidth - margin.Horizontal, 0)).Height + margin.Vertical;
System\Windows\Forms\Printing\PrintPreviewControl.cs (7)
34private Size _virtualSize = new(1, 1);
60Size = new Size(100, 100);
491_imageSize = new Size((int)(_zoom * pageSize.Width), (int)(_zoom * pageSize.Height));
494SetVirtualSizeNoInvalidate(PhysicalToPixels(new Size(virtualX, virtualY), _screenDPI));
661_imageSize = new Size((int)(_zoom * pageSize.Width), (int)(_zoom * pageSize.Height));
752new(PixelsToPhysical(pixels.Width, dpi.X), PixelsToPhysical(pixels.Height, dpi.Y));
758new(PhysicalToPixels(physical.Width, dpi.X), PhysicalToPixels(physical.Height, dpi.Y));
System\Windows\Forms\Control.cs (44)
357Size defaultSize = DefaultSize;
1174public Size ClientSize
1582protected virtual Size DefaultMaximumSize => CommonProperties.DefaultMaximumSize;
1584protected virtual Size DefaultMinimumSize => CommonProperties.DefaultMinimumSize;
1594protected virtual Size DefaultSize => Size.Empty;
2049public virtual Size GetPreferredSize(Size proposedSize)
2065Size cachedSize = CommonProperties.xGetPreferredSizeCache(this);
2074Size preferredSize;
2101internal virtual Size GetPreferredSizeCore(Size proposedSize)
2467[AmbientValue(typeof(Size), "0, 0")]
2468public virtual Size MaximumSize
2473if (value == Size.Empty)
2490public virtual Size MinimumSize
3011public Size Size
3740public Size PreferredSize
3742get { return GetPreferredSize(Size.Empty); }
5176internal Size ApplySizeConstraints(int width, int height)
5183internal Size ApplySizeConstraints(Size proposedSize)
5193if (MaximumSize != Size.Empty || MinimumSize != Size.Empty)
5195Size maximumSize = LayoutUtils.ConvertZeroToUnbounded(MaximumSize);
6352public Size LogicalToDeviceUnits(Size value) => ScaleHelper.ScaleToDpi(value, DeviceDpi);
9705Size minSize = MinimumSize;
9706Size maxSize = MaximumSize;
9709MinimumSize = Size.Empty;
9710MaximumSize = Size.Empty;
9752Size adornmentSize = adornments.Size;
9757LayoutUtils.UnionSizes(Size.Empty, minSize), // make sure we don't go below 0.
9766LayoutUtils.UnionSizes(Size.Empty, maxSize), // make sure we don't go below 0.
9773Size maximumSize = LayoutUtils.ConvertZeroToUnbounded(maxSize);
9774Size scaledSize = LayoutUtils.IntersectSizes(rawScaledBounds.Size, maximumSize);
9831internal Size ScaleSize(Size startSize, float x, float y)
9833Size size = startSize;
10146protected virtual Size SizeFromClientSize(Size clientSize) => SizeFromClientSizeInternal(clientSize);
10148internal Size SizeFromClientSizeInternal(Size size)
10654Size s = DefaultSize;
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.LayoutOptions.cs (34)
32public Size ImageSize { get; set; }
117private Size Compose(Size checkSize, Size imageSize, Size textSize)
148private Size Decompose(Size checkSize, Size imageSize, Size proposedSize)
187internal Size GetPreferredSizeCore(Size proposedSize)
196Size bordersAndPadding = new(linearBorderAndPadding, linearBorderAndPadding);
201Size checkSize = checkSizeLinear > 0 ? new(checkSizeLinear + 1, checkSizeLinear) : Size.Empty;
204Size textImageInsetSize = new(TextImageInset * 2, TextImageInset * 2);
205Size requiredImageSize = (ImageSize != Size.Empty) ? ImageSize + textImageInsetSize : Size.Empty;
211Size textSize = Size.Empty;
232Size requiredSize = Compose(checkSize, ImageSize, textSize);
286layout.Focus = ImageSize != Size.Empty
490if (ImageSize == Size.Empty || Text is null || Text.Length == 0 || textImageRelation == TextImageRelation.Overlay)
493Size textSize = GetTextSize(maxBounds.Size);
496Size size = ImageSize;
497if (layout.Options.DotNetOneButtonCompat && ImageSize != Size.Empty)
508Size maxTextSize = LayoutUtils.SubAlignedRegion(maxBounds.Size, ImageSize, textImageRelation);
509Size textSize = GetTextSize(maxTextSize);
513Size combinedSize = LayoutUtils.AddAlignedRegion(textSize, ImageSize, textImageRelation);
659protected virtual Size GetTextSize(Size proposedSize)
663Size textSize = Size.Empty;
670textSize = Size.Ceiling(
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (17)
422public Size PreferredSize => GetPreferredSize(RowIndex);
591public Size Size => GetSize(RowIndex);
1681internal static DataGridViewFreeDimension GetFreeDimensionFromConstraint(Size constraintSize)
2293internal Size GetPreferredSize(int rowIndex)
2302return GetPreferredSize(screen, dataGridViewCellStyle, rowIndex, Size.Empty);
2305protected virtual Size GetPreferredSize(
2309Size constraintSize) => new(-1, -1);
2328Size size = MeasureTextSize(g, text, cellStyle.Font!, flags);
2348protected virtual Size GetSize(int rowIndex)
2552Size requiredSize = TextRenderer.MeasureText(text, font, new Size(maxWidth, int.MaxValue), flags);
2558public static Size MeasureTextPreferredSize(
2579Size textOneLineSize = MeasureTextSize(graphics, text, font, flags);
2587Size textSize;
2604public static Size MeasureTextSize(
2633Size oneLineSize = MeasureTextSize(graphics, text, font, flags);
2643Size textSize;
3954internal static bool TextFitsInBounds(Graphics graphics, string text, Font font, Size maxBounds, TextFormatFlags flags)
System\Windows\Forms\Controls\DataGridView\DataGridViewUtilities.cs (7)
150internal static Size GetPreferredRowHeaderSize(
158Size constraintSize,
161Size preferredSize;
322Size sizeRequired = TextRenderer.MeasureText(text, font, new Size(int.MaxValue, int.MaxValue), flags);
329Size sizeCell = new(cellBounds.Width, cellBounds.Height);
330Size sizeConstraint = TextRenderer.MeasureText(text, font, sizeCell, flags);
351Size sizeText,
System\Windows\Forms\Controls\MonthCalendar\MonthCalendar.cs (14)
84private static readonly Size s_defaultSingleMonthSize = new(176, 153);
98private Size _dimensions = new(1, 1);
272public Size CalendarDimensions
325protected override Size DefaultSize => GetMinReqRect();
796public Size SingleMonthSize
822public new Size Size
1080Size minSize = GetMinReqRect();
1177private Size GetMinReqRect() => GetMinReqRect(0, false, false);
1185private Size GetMinReqRect(int newDimensionLength, bool updateRows, bool updateCols)
1187Size minSize = SingleMonthSize;
1190Size textExtent;
1278Size preferredSize = GetMinReqRect(height, updateRows, false);
1288Size preferredSize = GetMinReqRect(width, false, updateCols);
1654Size max = SystemInformation.MaxWindowTrackSize;
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.cs (17)
98private static readonly Size s_defaultLargeButtonSize = new(32, 32);
99private static readonly Size s_defaultNormalButtonSize = new(16, 16);
100private static Size s_largeButtonSize = s_defaultLargeButtonSize;
101private static Size s_normalButtonSize = s_defaultNormalButtonSize;
546protected override Size DefaultSize => new(130, 130);
2632int endSize = Size.Height;
2657helpOptimalHeight = _helpPane.GetOptimalHeight(Size.Width - s_cyDivider);
2674commandsOptimalHeight = _commandsPane.GetOptimalHeight(Size.Width - s_cyDivider);
2713_helpPane.SetBounds(0, endSize - height, Size.Width, height);
2758_commandsPane.SetBounds(0, endSize - height, Size.Width, height);
2763_gridView.Size = new Size(Size.Width, endSize - _gridView.Location.Y);
2829Size size = _targetMove.Size;
2836Invalidate(new Rectangle(0, me.Y - s_cyDivider, Size.Width, me.Y + s_cyDivider));
2839_gridView.Invalidate(new Rectangle(0, _gridView.Size.Height - s_cyDivider, Size.Width, s_cyDivider));
2895int width = Size.Width;
2921pevent.Graphics.FillRectangle(backgroundBrush, new Rectangle(0, yLast, width, Size.Height - yLast));
4105Size size = child.Size;
System\Windows\Forms\Controls\ToolStrips\ToolStripItem.ToolStripItemInternalLayout.ToolStripLayoutData.cs (1)
16private Size _size;
System\Windows\Forms\Controls\ToolStrips\ToolStripSettingsManager.SettingsStub.cs (1)
18public Size Size;
System\Windows\Forms\Form.cs (53)
149private Size _autoScaleBaseSize = Size.Empty;
150private Size _minAutoSize = Size.Empty;
166private Dictionary<int, Size>? _dpiFormSizes;
440public virtual Size AutoScaleBaseSize
502_minAutoSize = Size.Empty;
669Size size = ClientSize;
731public new Size ClientSize
886protected override Size DefaultSize => new Size(300, 300);
1190[DefaultValue(typeof(Size), "0, 0")]
1191public override Size MaximumSize
1193get => Properties.TryGetValue(s_propMaxTrackSize, out Size maximumSize) ? maximumSize : Size.Empty;
1208private void UpdateMaximumSize(Size value, bool updateFormSize = true)
1215Size minimumSize = MinimumSize;
1240Size size = Size;
1304public override Size MinimumSize
1306get => Properties.TryGetValue(s_propMinTrackSize, out Size minimumSize) ? minimumSize : DefaultMinimumSize;
1325private void UpdateMinimumSize(Size value, bool updateFormSize = true)
1332Size maximumSize = MaximumSize;
1357Size size = Size;
1828public new Size Size
2982Size baseVar = AutoScaleBaseSize;
2984Size newVar = new((int)Math.Round(newVarF.Width), (int)Math.Round(newVarF.Height));
3016Size correctClientSize = ClientSize;
3055Size correct = ComputeWindowSize(correctClientSize);
3205private Size ComputeWindowSize(Size clientSize)
3215private Size ComputeWindowSize(Size clientSize, WINDOW_STYLE style, WINDOW_EX_STYLE exStyle)
3620Size correct = ComputeWindowSize(ClientSize, (WINDOW_STYLE)maskedStyle, (WINDOW_EX_STYLE)cp.ExStyle);
3851Size s = Size;
4203Size prefSize = PreferredSize;
4208Size adjustedSize = AutoSizeMode == AutoSizeMode.GrowAndShrink ? prefSize : LayoutUtils.UnionSizes(prefSize, Size);
4403Size size = ClientSize;
4533protected virtual bool OnGetDpiScaledSize(int deviceDpiOld, int deviceDpiNew, ref Size desiredSize)
4573Size desiredSize = default;
5004Size restoredSize = _restoredWindowBounds.Size;
5082Size clientSize = ClientSize;
5112Size minSize = MinimumSize;
5113Size maxSize = MaximumSize;
5227Size max = SystemInformation.MaxWindowTrackSize;
5247Size min = SystemInformation.MinWindowTrackSize;
5933_autoScaleBaseSize = Size.Empty;
6140Size previousClientSize = ClientSize;
6759Size minTrack = (AutoSize && _formStateEx[s_formStateExInModalSizingLoop] == 1) ? LayoutUtils.UnionSizes(_minAutoSize, MinimumSize) : MinimumSize;
6761Size maxTrack = MaximumSize;
6775private unsafe void WmGetMinMaxInfoHelper(ref Message m, Size minTrack, Size maxTrack, Rectangle maximizedBounds)
6795Size virtualScreen = SystemInformation.VirtualScreen.Size;
6811Size minTrackWindowSize = SystemInformation.MinWindowTrackSize;
6904Size clientSize = ClientSize;
System\Windows\Forms\Layout\CommonProperties.cs (25)
32internal static Size DefaultMinimumSize { get; } = new(0, 0);
33internal static Size DefaultMaximumSize { get; } = new(0, 0);
97internal static Size GetMaximumSize(IArrangedElement element, Size defaultMaximumSize)
99if (element.Properties.TryGetValue(s_maximumSizeProperty, out Size size))
110internal static Size GetMinimumSize(IArrangedElement element, Size defaultMinimumSize)
112if (element.Properties.TryGetValue(s_minimumSizeProperty, out Size size))
126/// and/or the <see cref="Control.GetPreferredSize(Size)"/> calculation of a control.
198internal static void SetMaximumSize(IArrangedElement element, Size value)
220internal static void SetMinimumSize(IArrangedElement element, Size value)
342/// <see cref="Control.GetPreferredSizeCore(Size)"/> method. DO NOT CALL DIRECTLY
348Debug.Assert(xGetPreferredSizeCache(element) == Size.Empty, "Error detected in xClearPreferredSizeCache.");
372/// <see cref="Control.GetPreferredSizeCore(Size)"/> implementation when asked for a constraining
373/// value of <see cref="LayoutUtils.s_maxSize"/> (or <see cref="Size.Empty"/> too).
375internal static Size xGetPreferredSizeCache(IArrangedElement element)
377if (element.Properties.TryGetValue(s_preferredSizeCacheProperty, out Size size) && (size != LayoutUtils.s_invalidSize))
382return Size.Empty;
388internal static void xSetPreferredSizeCache(IArrangedElement element, Size value)
391value == Size.Empty || value != xGetPreferredSizeCache(element),
674internal static Size GetLayoutBounds(IArrangedElement element)
676if (element.Properties.TryGetValue(s_layoutBoundsProperty, out Size size))
681return Size.Empty;
689/// The <see cref="TableLayout"/> engine now calls <see cref="SetLayoutBounds(IArrangedElement, Size)"/> when it
697internal static void SetLayoutBounds(IArrangedElement element, Size value)
System\Windows\Forms\Layout\DefaultLayout.cs (35)
35Size proposedConstraints = LayoutUtils.s_maxSize;
47Size prefSize = element.GetPreferredSize(proposedConstraints);
60Size newSize = LayoutUtils.UnionSizes(bounds.Size, prefSize);
78private static Rectangle GetGrowthBounds(IArrangedElement element, Size newSize)
374private static Size LayoutDockedControls(IArrangedElement container, bool measureOnly)
381Size preferredSize = Size.Empty;
400Size elementSize = GetVerticalDockedSize(element, remainingBounds.Size, measureOnly);
413Size elementSize = GetVerticalDockedSize(element, remainingBounds.Size, measureOnly);
426Size elementSize = GetHorizontalDockedSize(element, remainingBounds.Size, measureOnly);
439Size elementSize = GetHorizontalDockedSize(element, remainingBounds.Size, measureOnly);
457Size elementSize = remainingBounds.Size;
484private static void TryCalculatePreferredSizeDockedControl(IArrangedElement element, Rectangle newElementBounds, bool measureOnly, ref Size preferredSize, ref Rectangle remainingBounds)
488Size neededSize = new(
510Size elementPrefSize = element.GetPreferredSize(neededSize);
537private static Size GetVerticalDockedSize(IArrangedElement element, Size remainingSize, bool measureOnly)
539Size newSize = xGetDockedSize(element, /* constraints = */ new Size(remainingSize.Width, 1));
554private static Size GetHorizontalDockedSize(IArrangedElement element, Size remainingSize, bool measureOnly)
556Size newSize = xGetDockedSize(element, /* constraints = */ new Size(1, remainingSize.Height));
571private static Size xGetDockedSize(IArrangedElement element, Size constraints)
573Size desiredSize;
592return TryCalculatePreferredSize(container, measureOnly: false, preferredSize: out Size _);
598private static bool TryCalculatePreferredSize(IArrangedElement container, bool measureOnly, out Size preferredSize)
635Size preferredSizeForDocking = Size.Empty;
636Size preferredSizeForAnchoring;
1103internal override Size GetPreferredSize(IArrangedElement container, Size proposedBounds)
1107TryCalculatePreferredSize(container, measureOnly: true, preferredSize: out Size prefSize);
1111private static Size GetAnchorPreferredSize(IArrangedElement container)
1113Size prefSize = Size.Empty;
System\Windows\Forms\Layout\FlowLayout.cs (14)
23internal override Size GetPreferredSize(IArrangedElement container, Size proposedConstraints)
26Size prefSize = TryCalculatePreferredSize(container, measureBounds, measureOnly: true);
53private static Size TryCalculatePreferredSize(IArrangedElement container, Rectangle displayRect, bool measureOnly)
65Size layoutSize = Size.Empty;
77Size rowSize = MeasureRow(containerProxy, elementProxy, i, measureBounds, out int breakIndex);
137private static Size MeasureRow(
156private static Size TryCalculatePreferredSizeRow(
167Size rowSize = Size.Empty;
184Size prefSize;
187Size elementConstraints = new(int.MaxValue, rowBounds.Height - elementProxy.Margin.Size.Height);
218Size requiredSize = prefSize + elementProxy.Margin.Size;
System\Windows\Forms\Layout\LayoutUtils.cs (45)
13public static readonly Size s_maxSize = new(int.MaxValue, int.MaxValue);
14public static readonly Size s_invalidSize = new(int.MinValue, int.MinValue);
43public static Size OldGetLargestStringSizeInCollection(Font? font, ICollection? objects)
45Size largestSize = Size.Empty;
50Size textSize = TextRenderer.MeasureText(obj.ToString(), font, new Size(short.MaxValue, short.MaxValue), TextFormatFlags.SingleLine);
124public static Size ConvertZeroToUnbounded(Size size)
205public static Size UnionSizes(Size a, Size b)
212public static Size IntersectSizes(Size a, Size b)
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)
354public static Size Stretch(Size stretchThis, Size withinThis, AnchorStyles anchorStyles)
356Size stretchedSize = new(
390public static Size AddAlignedRegion(Size textSize, Size imageSize, TextImageRelation relation)
395public static Size AddAlignedRegionCore(Size currentSize, Size contentSize, bool vertical)
453public static Size FlipSize(Size size)
460public static Size FlipSizeIf(bool condition, Size size)
493public static bool IsZeroWidthOrHeight(Size size)
498public static bool AreWidthAndHeightLarger(Size size1, Size size2)
503public static void SplitRegion(Rectangle bounds, Size specifiedContent, AnchorStyles region1Align, out Rectangle region1, out Rectangle region2)
570public static Size SubAlignedRegion(Size currentSize, Size contentSize, TextImageRelation relation)
575public static Size SubAlignedRegionCore(Size currentSize, Size contentSize, bool vertical)
System\Windows\Forms\Layout\LayoutUtils.MeasureTextCache.cs (6)
22private Size _unconstrainedPreferredSize = s_invalidSize;
29public Size GetTextSize(string? text, Font? font, Size proposedConstraints, TextFormatFlags flags)
78Size prefSize = TextRenderer.MeasureText(text, font, proposedConstraints, flags);
99public bool TextRequiresWordBreak(string? text, Font? font, Size size, TextFormatFlags flags)
108private Size GetUnconstrainedSize(string? text, Font? font, TextFormatFlags flags)
System\Windows\Forms\Layout\TableLayout.cs (18)
105Size containerSize = container.DisplayRectangle.Size - new Size(cellBorderWidth, cellBorderWidth);
111Size usedSpace = ApplyStyles(containerInfo, containerSize, measureOnly: false);
135internal override Size GetPreferredSize(IArrangedElement container, Size proposedConstraints)
145Size prefSize = containerInfo.GetCachedPreferredSize(proposedConstraints, out bool isCacheValid);
162Size containerSize = container.DisplayRectangle.Size - new Size(cellBorderWidth * 2, cellBorderWidth * 2);
176Size cellBorderSize = new(cellBorderWidth, cellBorderWidth);
222private static void ExpandLastElement(ContainerInfo containerInfo, Size usedSpace, Size totalSpace)
617private static Size ApplyStyles(ContainerInfo containerInfo, Size proposedConstraints, bool measureOnly)
619Size preferredSize = Size.Empty;
675private static int InflateColumns(ContainerInfo containerInfo, Size proposedConstraints, bool measureOnly)
732maxWidth = GetElementSize(element, Size.Empty).Width;
801private static int InflateRows(ContainerInfo containerInfo, Size proposedConstraints, int expandLastElementWidth, bool measureOnly)
866private static Size GetElementSize(IArrangedElement element, Size proposedConstraints) =>
System\Windows\Forms\Rendering\TextRenderer.cs (38)
23internal static Size MaxSize { get; } = new(int.MaxValue, int.MaxValue);
381public static Size MeasureText(string? text, Font? font)
390/// The <see cref="Size"/>, in pixels, of text drawn on a single line with the specified font. You can
399/// <see cref="MeasureText(IDeviceContext, string?, Font?, Size, TextFormatFlags)"/>.
401public static Size MeasureText(ReadOnlySpan<char> text, Font? font)
404public static Size MeasureText(string? text, Font? font, Size proposedSize)
413/// <param name="proposedSize">The <see cref="Size"/> of the initial bounding rectangle.</param>
415/// The <see cref="Size"/>, in pixels, of <paramref name="text"/> drawn with the specified
418public static Size MeasureText(ReadOnlySpan<char> text, Font? font, Size proposedSize)
421public static Size MeasureText(string? text, Font? font, Size proposedSize, TextFormatFlags flags)
430/// <param name="proposedSize">The <see cref="Size"/> of the initial bounding rectangle.</param>
433/// The <see cref="Size"/>, in pixels, of <paramref name="text"/> drawn with the specified
439public static Size MeasureText(ReadOnlySpan<char> text, Font? font, Size proposedSize, TextFormatFlags flags)
442public static Size MeasureText(IDeviceContext dc, string? text, Font? font)
452/// The <see cref="Size"/>, in pixels, of <paramref name="text"/> drawn with the specified
456public static Size MeasureText(IDeviceContext dc, ReadOnlySpan<char> text, Font? font)
459public static Size MeasureText(IDeviceContext dc, string? text, Font? font, Size proposedSize)
469/// <param name="proposedSize">The <see cref="Size"/> of the initial bounding rectangle.</param>
471/// The <see cref="Size"/>, in pixels, of <paramref name="text"/> drawn with the specified
475public static Size MeasureText(IDeviceContext dc, ReadOnlySpan<char> text, Font? font, Size proposedSize)
478public static Size MeasureText(
482Size proposedSize,
493/// <param name="proposedSize">The <see cref="Size"/> of the initial bounding rectangle.</param>
496/// The <see cref="Size"/>, in pixels, of <paramref name="text"/> drawn with the specified
503public static Size MeasureText(
507Size proposedSize,
511private static Size MeasureTextInternal(
514Size proposedSize,
518return Size.Empty;
526private static Size MeasureTextInternal(
530Size proposedSize,
536return Size.Empty;
System\Windows\Forms\SystemInformation.cs (32)
57public static Size PrimaryMonitorSize => GetSize(SM_CXSCREEN, SM_CYSCREEN);
93public static Size BorderSize => GetSize(SM_CXBORDER, SM_CYBORDER);
98public static Size GetBorderSizeForDpi(int dpi)
109public static Size FixedFrameBorderSize => GetSize(SM_CXFIXEDFRAME, SM_CYFIXEDFRAME);
124public static Size IconSize => GetSize(SM_CXICON, SM_CYICON);
129public static Size CursorSize => GetSize(SM_CXCURSOR, SM_CYCURSOR);
241public static Size MinimumWindowSize => GetSize(SM_CXMIN, SM_CYMIN);
246public static Size CaptionButtonSize => GetSize(SM_CXSIZE, SM_CYSIZE);
251public static Size FrameBorderSize => GetSize(SM_CXFRAME, SM_CYFRAME);
256public static Size MinWindowTrackSize => GetSize(SM_CXMINTRACK, SM_CYMINTRACK);
263public static Size DoubleClickSize => GetSize(SM_CXDOUBLECLK, SM_CYDOUBLECLK);
273public static Size IconSpacingSize => GetSize(SM_CXICONSPACING, SM_CYICONSPACING);
305public static Size Border3DSize => GetSize(SM_CXEDGE, SM_CYEDGE);
310public static Size MinimizedWindowSpacingSize => GetSize(SM_CXMINSPACING, SM_CYMINSPACING);
315public static Size SmallIconSize => GetSize(SM_CXSMICON, SM_CYSMICON);
325public static Size ToolWindowCaptionButtonSize => GetSize(SM_CXSMSIZE, SM_CYSMSIZE);
330public static Size MenuButtonSize => GetSize(SM_CXMENUSIZE, SM_CYMENUSIZE);
366public static Size MinimizedWindowSize => GetSize(SM_CXMINIMIZED, SM_CYMINIMIZED);
372public static Size MaxWindowTrackSize => GetSize(SM_CXMAXTRACK, SM_CYMAXTRACK);
378public static Size PrimaryMonitorMaximizedWindowSize => GetSize(SM_CXMAXIMIZED, SM_CYMAXIMIZED);
396public static Size DragSize => GetSize(SM_CXDRAG, SM_CYDRAG);
408public static Size MenuCheckSize => GetSize(SM_CXMENUCHECK, SM_CYMENUCHECK);
461Size size = PrimaryMonitorSize;
591/// Gets the <see cref="Size"/> in pixels of the rectangle within which the mouse
594public static Size MouseHoverSize
761/// The <see cref="Size"/>, in pixels, of the small caption buttons.
763public static unsafe Size SmallCaptionButtonSize
771: Size.Empty;
776/// The <see cref="Size"/>, in pixels, of the menu bar buttons.
778public static unsafe Size MenuBarButtonSize
786: Size.Empty;
814private static Size GetSize(SYSTEM_METRICS_INDEX x, SYSTEM_METRICS_INDEX y)