Size.Round メソッドとは? わかりやすく解説

Size.Round メソッド

指定SizeF 構造体を、SizeF 構造体の値を最も近い整数値に丸めることによって、Size 構造体変換します

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

使用例使用例

静的 Round メソッドおよび Truncate メソッド使用して SizeFSize変換する方法を示すコード例次に示します。この例は、Windows フォームでの使用意図してデザインされています。この例を実行するには、Label1Label2 という名前の 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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「Size.Round メソッド」の関連用語

Size.Round メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



Size.Round メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS