Size.Truncate(SizeF) 方法 
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
public:
 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.SizePublic Shared Function Truncate (value As SizeF) As Size参数
返回
由此方法转换得到的 Size 结构。
示例
下面的代码示例演示如何使用静态 Round 和 方法将 转换为 SizeFSize。Truncate 此示例旨在与 Windows 窗体 一起使用。 若要运行此示例,请将其粘贴到包含名为 和 Label2的两Label个Label1对象的窗体中,然后从窗体的构造函数调用此方法。
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