Size.Truncate(SizeF) Method


SizeF 구조체의 값을 다음으로 낮은 정수 값으로 버림하여 지정된 Size 구조체를 SizeF 구조체로 변환합니다.Converts the specified SizeF structure to a Size structure by truncating the values of the SizeF structure to the next lower integer values.

 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



변환할 SizeF 구조체입니다.The SizeF structure to convert.



이 메서드가 변환될 Size 구조체입니다.The Size structure this method converts to.


다음 코드 예제에서는 정적 RoundTruncate 메서드를 사용 하 여 SizeFSize으로 변환 하는 방법을 보여 줍니다.The following code example demonstrates how to use static Round and Truncate methods to convert a SizeF to a Size. 이 예제에서는 Windows Forms를 사용 하 여 사용 하도록 설계 되었습니다.This example is designed to be used with Windows Forms. 이 예제를 실행 하려면 Label1Label2라는 두 개의 Label 개체가 포함 된 양식에 붙여넣은 다음 폼의 생성자에서이 메서드를 호출 합니다.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

Applies to