Size.Round(SizeF) Metodo
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
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
Struttura Size in cui questo metodo esegue la conversione.
Nell'esempio di codice seguente viene illustrato come usare metodi e statici Round per convertire un SizeF oggetto in un oggetto Size.Truncate Questo esempio è progettato per essere usato con Windows Forms. Per eseguire questo esempio, incollarlo in una maschera contenente due Label oggetti denominati Label1
e Label2
, quindi chiamare questo metodo dal costruttore del modulo.
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
Prodotto | Versioni |
---|---|
.NET | Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9 |
.NET Framework | 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1 |
.NET Standard | 2.0, 2.1 |
Feedback su .NET
.NET è un progetto di open source. Selezionare un collegamento per fornire feedback: