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);
3776editingControl.Size = new Size(editingControlBounds.Width, editingControlBounds.Height);
3862DataGridView.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\Controls\PropertyGrid\PropertyGridInternal\PropertyGridView.cs (10)
217? new(SystemInformation.VerticalScrollBarArrowHeightForDpi(DeviceDpiInternal), RowHeight)
218: new(SystemInformation.VerticalScrollBarArrowHeight, RowHeight);
255? new Size(SystemInformation.VerticalScrollBarArrowHeightForDpi(DeviceDpiInternal), RowHeight)
256: new Size(SystemInformation.VerticalScrollBarArrowHeight, RowHeight);
938Size size = new(width, height);
1968Size sizeWindow = new(rect.Width, rect.Height);
4334? new Size(SystemInformation.VerticalScrollBarArrowHeightForDpi(DeviceDpiInternal), RowHeight)
4335: new Size(SystemInformation.VerticalScrollBarArrowHeight, RowHeight);
5147_dropDownButton.Size = new(SystemInformation.VerticalScrollBarArrowHeightForDpi(DeviceDpiInternal), RowHeight);
5151_dropDownButton.Size = new(SystemInformation.VerticalScrollBarArrowHeight, RowHeight);
System\Windows\Forms\Form.cs (6)
446return new Size((int)Math.Round(real.Width), (int)Math.Round(real.Height));
883protected override Size DefaultSize => new Size(300, 300);
1240Size = new Size(Math.Min(size.Width, value.Width), Math.Min(size.Height, value.Height));
1357Size = new Size(Math.Max(size.Width, value.Width), Math.Max(size.Height, value.Height));
3059Size newVar = new((int)Math.Round(newVarF.Width), (int)Math.Round(newVarF.Height));
4539_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)
368Size defaultSize = DefaultSize;
1242public Size ClientSize
1650protected virtual Size DefaultMaximumSize => CommonProperties.DefaultMaximumSize;
1652protected virtual Size DefaultMinimumSize => CommonProperties.DefaultMinimumSize;
1662protected virtual Size DefaultSize => Size.Empty;
2117public virtual Size GetPreferredSize(Size proposedSize)
2133Size cachedSize = CommonProperties.xGetPreferredSizeCache(this);
2142Size preferredSize;
2169internal virtual Size GetPreferredSizeCore(Size proposedSize)
2535[AmbientValue(typeof(Size), "0, 0")]
2536public virtual Size MaximumSize
2541if (value == Size.Empty)
2558public virtual Size MinimumSize
3079public Size Size
3808public Size PreferredSize
3810get { return GetPreferredSize(Size.Empty); }
5244internal Size ApplySizeConstraints(int width, int height)
5251internal Size ApplySizeConstraints(Size proposedSize)
5261if (MaximumSize != Size.Empty || MinimumSize != Size.Empty)
5263Size maximumSize = LayoutUtils.ConvertZeroToUnbounded(MaximumSize);
6420public Size LogicalToDeviceUnits(Size value) => ScaleHelper.ScaleToDpi(value, DeviceDpi);
9782Size minSize = MinimumSize;
9783Size maxSize = MaximumSize;
9786MinimumSize = Size.Empty;
9787MaximumSize = Size.Empty;
9829Size adornmentSize = adornments.Size;
9834LayoutUtils.UnionSizes(Size.Empty, minSize), // make sure we don't go below 0.
9843LayoutUtils.UnionSizes(Size.Empty, maxSize), // make sure we don't go below 0.
9850Size maximumSize = LayoutUtils.ConvertZeroToUnbounded(maxSize);
9851Size scaledSize = LayoutUtils.IntersectSizes(rawScaledBounds.Size, maximumSize);
9908internal Size ScaleSize(Size startSize, float x, float y)
9910Size size = startSize;
10220protected virtual Size SizeFromClientSize(Size clientSize) => SizeFromClientSizeInternal(clientSize);
10222internal Size SizeFromClientSizeInternal(Size size)
10728Size 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;
3958internal 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);
269public Size CalendarDimensions
326protected override Size DefaultSize => GetMinReqRect();
797public Size SingleMonthSize
823public new Size Size
1081Size minSize = GetMinReqRect();
1178private Size GetMinReqRect() => GetMinReqRect(0, false, false);
1186private Size GetMinReqRect(int newDimensionLength, bool updateRows, bool updateCols)
1188Size minSize = SingleMonthSize;
1191Size textExtent;
1279Size preferredSize = GetMinReqRect(height, updateRows, false);
1289Size preferredSize = GetMinReqRect(width, false, updateCols);
1655Size max = SystemInformation.MaxWindowTrackSize;
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)
150private Size _autoScaleBaseSize = Size.Empty;
151private Size _minAutoSize = Size.Empty;
167private Dictionary<int, Size>? _dpiFormSizes;
437public virtual Size AutoScaleBaseSize
499_minAutoSize = Size.Empty;
666Size size = ClientSize;
728public new Size ClientSize
883protected override Size DefaultSize => new Size(300, 300);
1187[DefaultValue(typeof(Size), "0, 0")]
1188public override Size MaximumSize
1190get => Properties.TryGetValue(s_propMaxTrackSize, out Size maximumSize) ? maximumSize : Size.Empty;
1205private void UpdateMaximumSize(Size value, bool updateFormSize = true)
1212Size minimumSize = MinimumSize;
1237Size size = Size;
1301public override Size MinimumSize
1303get => Properties.TryGetValue(s_propMinTrackSize, out Size minimumSize) ? minimumSize : DefaultMinimumSize;
1322private void UpdateMinimumSize(Size value, bool updateFormSize = true)
1329Size maximumSize = MaximumSize;
1354Size size = Size;
1906public new Size Size
3057Size baseVar = AutoScaleBaseSize;
3059Size newVar = new((int)Math.Round(newVarF.Width), (int)Math.Round(newVarF.Height));
3091Size correctClientSize = ClientSize;
3130Size correct = ComputeWindowSize(correctClientSize);
3280private Size ComputeWindowSize(Size clientSize)
3290private Size ComputeWindowSize(Size clientSize, WINDOW_STYLE style, WINDOW_EX_STYLE exStyle)
3695Size correct = ComputeWindowSize(ClientSize, (WINDOW_STYLE)maskedStyle, (WINDOW_EX_STYLE)cp.ExStyle);
3926Size s = Size;
4269Size prefSize = PreferredSize;
4274Size adjustedSize = AutoSizeMode == AutoSizeMode.GrowAndShrink ? prefSize : LayoutUtils.UnionSizes(prefSize, Size);
4462Size size = ClientSize;
4592protected virtual bool OnGetDpiScaledSize(int deviceDpiOld, int deviceDpiNew, ref Size desiredSize)
4632Size desiredSize = default;
5098Size restoredSize = _restoredWindowBounds.Size;
5173Size clientSize = ClientSize;
5203Size minSize = MinimumSize;
5204Size maxSize = MaximumSize;
5318Size max = SystemInformation.MaxWindowTrackSize;
5338Size min = SystemInformation.MinWindowTrackSize;
6024_autoScaleBaseSize = Size.Empty;
6231Size previousClientSize = ClientSize;
6850Size minTrack = (AutoSize && _formStateEx[s_formStateExInModalSizingLoop] == 1) ? LayoutUtils.UnionSizes(_minAutoSize, MinimumSize) : MinimumSize;
6852Size maxTrack = MaximumSize;
6866private unsafe void WmGetMinMaxInfoHelper(ref Message m, Size minTrack, Size maxTrack, Rectangle maximizedBounds)
6886Size virtualScreen = SystemInformation.VirtualScreen.Size;
6902Size minTrackWindowSize = SystemInformation.MinWindowTrackSize;
6995Size 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)
34Size proposedConstraints = LayoutUtils.s_maxSize;
46Size prefSize = element.GetPreferredSize(proposedConstraints);
59Size newSize = LayoutUtils.UnionSizes(bounds.Size, prefSize);
77private static Rectangle GetGrowthBounds(IArrangedElement element, Size newSize)
373private static Size LayoutDockedControls(IArrangedElement container, bool measureOnly)
380Size preferredSize = Size.Empty;
399Size elementSize = GetVerticalDockedSize(element, remainingBounds.Size, measureOnly);
412Size elementSize = GetVerticalDockedSize(element, remainingBounds.Size, measureOnly);
425Size elementSize = GetHorizontalDockedSize(element, remainingBounds.Size, measureOnly);
438Size elementSize = GetHorizontalDockedSize(element, remainingBounds.Size, measureOnly);
456Size elementSize = remainingBounds.Size;
483private static void TryCalculatePreferredSizeDockedControl(IArrangedElement element, Rectangle newElementBounds, bool measureOnly, ref Size preferredSize, ref Rectangle remainingBounds)
487Size neededSize = new(
509Size elementPrefSize = element.GetPreferredSize(neededSize);
536private static Size GetVerticalDockedSize(IArrangedElement element, Size remainingSize, bool measureOnly)
538Size newSize = xGetDockedSize(element, /* constraints = */ new Size(remainingSize.Width, 1));
553private static Size GetHorizontalDockedSize(IArrangedElement element, Size remainingSize, bool measureOnly)
555Size newSize = xGetDockedSize(element, /* constraints = */ new Size(1, remainingSize.Height));
570private static Size xGetDockedSize(IArrangedElement element, Size constraints)
572Size desiredSize;
591return TryCalculatePreferredSize(container, measureOnly: false, preferredSize: out Size _);
597private static bool TryCalculatePreferredSize(IArrangedElement container, bool measureOnly, out Size preferredSize)
634Size preferredSizeForDocking = Size.Empty;
635Size preferredSizeForAnchoring;
1102internal override Size GetPreferredSize(IArrangedElement container, Size proposedBounds)
1106TryCalculatePreferredSize(container, measureOnly: true, preferredSize: out Size prefSize);
1110private static Size GetAnchorPreferredSize(IArrangedElement container)
1112Size 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)