Control.GetPreferredSize(Size) Metoda
Definicja
Pobiera rozmiar prostokątnego obszaru, w którym może być zamontowany formant.Retrieves the size of a rectangular area into which a control can be fitted.
public:
virtual System::Drawing::Size GetPreferredSize(System::Drawing::Size proposedSize);
public virtual System.Drawing.Size GetPreferredSize (System.Drawing.Size proposedSize);
abstract member GetPreferredSize : System.Drawing.Size -> System.Drawing.Size
override this.GetPreferredSize : System.Drawing.Size -> System.Drawing.Size
Public Overridable Function GetPreferredSize (proposedSize As Size) As Size
Parametry
- proposedSize
- Size
Obszar niestandardowy dla kontrolki.The custom-sized area for a control.
Zwraca
Uporządkowana para typu Size reprezentująca szerokość i wysokość prostokąta.An ordered pair of type Size representing the width and height of a rectangle.
Uwagi
Zachowanie GetPreferredSize różne przez kontrolkę.The behavior of GetPreferredSize differs by control. LayoutEngineMoże nie być możliwe przypisanie zwróconego rozmiaru do kontrolki.The LayoutEngine might be unable to assign the returned size to the control. Można zwrócić rozmiar większy niż ograniczenia wskazane w proposedSize
parametrze, ale proposedSize
powinien zostać zmniejszony w miarę zmniejszania ograniczeń.You can return a size larger than the constraints indicated in the proposedSize
parameter, but proposedSize
should decrease as the constraint decreases. Na przykład GetPreferredSize(new Size(100, 0))
nie powinna być większa niż GetPreferredSize(new Size(200, 0))
.For example, GetPreferredSize(new Size(100, 0))
should not be wider than GetPreferredSize(new Size(200, 0))
. Wyjątek to proposedSize
0 lub Size.Empty
, które są zdefiniowane jako nieograniczone.The exception is a proposedSize
of 0 or Size.Empty
, which are defined as unconstrained.