Size.Round メソッド
アセンブリ: System.Drawing (system.drawing.dll 内)

Dim value As SizeF Dim returnValue As Size returnValue = Size.Round(value)
戻り値
このメソッドの変換対象の Size 構造体。

静的 Round メソッドおよび Truncate メソッドを使用して SizeF を Size に変換する方法を示すコード例を次に示します。この例は、Windows フォームでの使用を意図してデザインされています。この例を実行するには、Label1 と Label2 という名前の 2 つの 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 によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


- Size.Round メソッドのページへのリンク