Size.Round(SizeF) 메서드

정의

SizeF 구조체의 값을 가장 가까운 정수 값으로 반올림하여 지정된 Size 구조체를 SizeF 구조체로 변환합니다.

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

매개 변수

value
SizeF

변환할 SizeF 구조체입니다.

반환

Size

이 메서드가 변환될 Size 구조체입니다.

예제

다음 코드 예제에서는 정적 Round 및 메서드를 사용 하 여 변환 SizeF 하는 방법을 보여 줍니다SizeTruncate. 이 예제는 Windows Forms 함께 사용하도록 설계되었습니다. 이 예제를 실행하려면 두 개체가 포함된 Label Label1 폼에 붙여넣은 Label2다음 폼의 생성자에서 이 메서드를 호출합니다.

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

적용 대상