Size.Truncate(SizeF) Size.Truncate(SizeF) Size.Truncate(SizeF) Size.Truncate(SizeF) Method

Definición

Convierte la estructura SizeF especificada en una estructura Size mediante el truncamiento de los valores de la estructura SizeF a los valores enteros inferiores siguientes.Converts the specified SizeF structure to a Size structure by truncating the values of the SizeF structure to the next lower integer values.

public:
 static System::Drawing::Size Truncate(System::Drawing::SizeF value);
public static System.Drawing.Size Truncate (System.Drawing.SizeF value);
static member Truncate : System.Drawing.SizeF -> System.Drawing.Size
Public Shared Function Truncate (value As SizeF) As Size

Parámetros

value
SizeF SizeF SizeF SizeF

Estructura SizeF que se va a convertir.The SizeF structure to convert.

Devoluciones

Estructura Size a la que se convierte este método.The Size structure this method converts to.

Ejemplos

En el ejemplo de código siguiente se muestra cómo usar estático Round y Truncate métodos para convertir un SizeF a un Size.The following code example demonstrates how to use static Round and Truncate methods to convert a SizeF to a Size. En este ejemplo está diseñado para usarse con Windows Forms.This example is designed to be used with Windows Forms. Para ejecutar este ejemplo, péguelo en un formulario que contiene dos Label objetos denominados Label1 y Label2y, a continuación, llame a este método desde el constructor del formulario.To run this example, paste it into a form that contains two Label objects named Label1 and Label2, and then call this method from the form's constructor.

void TruncateAndRoundSizes()
{
   // Create a SizeF.
   SizeF theSize = SizeF(75.9F,75.9F);
   
   // Round the Size.
   System::Drawing::Size roundedSize = ::Size::Round( theSize );
   
   // Truncate the Size.
   System::Drawing::Size truncatedSize = ::Size::Truncate( theSize );
   
   //Print out the values on two labels.
   Label1->Text = String::Format( "Rounded size = {0}", roundedSize );
   Label2->Text = String::Format( "Truncated size = {0}", truncatedSize );
}
private void TruncateAndRoundSizes()
{

    // Create a SizeF.
    SizeF theSize = new SizeF(75.9F, 75.9F);

    // Round the Size.
    Size roundedSize = Size.Round(theSize);

    // Truncate the Size.
    Size truncatedSize = Size.Truncate(theSize);

    //Print out the values on two labels.
    Label1.Text = "Rounded size = "+roundedSize.ToString();
    Label2.Text = "Truncated size = "+truncatedSize.ToString();

}
Private Sub TruncateAndRoundSizes()

    ' Create a SizeF.
    Dim theSize As New SizeF(75.9, 75.9)

    ' Round the Size.
    Dim roundedSize As Size = Size.Round(theSize)

    ' Truncate the Size.
    Dim truncatedSize As Size = Size.Truncate(theSize)

    'Print out the values on two labels.
    Label1.Text = "Rounded size = " & roundedSize.ToString()
    Label2.Text = "Truncated size = " & truncatedSize.ToString

End Sub

Se aplica a