Size.Round 메서드
SizeF 구조체의 값을 가장 가까운 정수 값으로 반올림하여 지정된 SizeF 구조체를 Size 구조체로 변환합니다.
네임스페이스: System.Drawing
어셈블리: System.Drawing(system.drawing.dll)
구문
‘선언
Public Shared Function Round ( _
value As SizeF _
) As Size
‘사용 방법
Dim value As SizeF
Dim returnValue As Size
returnValue = Size.Round(value)
public static Size Round (
SizeF value
)
public:
static Size Round (
SizeF value
)
public static Size Round (
SizeF value
)
public static function Round (
value : SizeF
) : Size
매개 변수
- value
변환할 SizeF 구조체입니다.
반환 값
이 메서드가 변환될 Size 구조체를 반환합니다.
예제
다음 코드 예제에서는 정적 Round 및 Truncate 메서드를 사용하여 SizeF를 Size로 변환하는 방법으로 보여 줍니다. 이 예제는 Windows Forms과 함께 사용해야 합니다. 이 예제를 실행하려면 Label1
과 Label2
라는 이름의 두 Label 개체가 포함된 폼에 코드를 붙여넣은 다음 폼의 생성자에서 이 메서드를 호출합니다.
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
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();
}
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.set_Text("Rounded size = " + roundedSize.ToString());
label2.set_Text("Truncated size = " + truncatedSize.ToString());
} //TruncateAndRoundSizes
플랫폼
Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
2.0, 1.1, 1.0에서 지원