Size.Implicit(Size to SizeF) Operatore

Definizione

Converte la struttura Size specificata in una struttura SizeF.

C#
public static implicit operator System.Drawing.SizeF (System.Drawing.Size p);

Parametri

p
Size

Struttura Size da convertire.

Restituisce

Struttura SizeF in cui questo operatore esegue la conversione.

Esempio

Nell'esempio di codice seguente vengono illustrate le Gproprietà , B, Re A di un Color oggetto e del Implicit membro .

Questo esempio è progettato per essere usato con Windows Form. Incollare il codice nel form e chiamare il ShowPropertiesOfSlateBlue metodo dal metodo di gestione degli eventi del Paint modulo, passando e come PaintEventArgs.

C#
private void ShowPropertiesOfSlateBlue(PaintEventArgs e)
{
    Color slateBlue = Color.FromName("SlateBlue");
    byte g = slateBlue.G;
    byte b = slateBlue.B;
    byte r = slateBlue.R;
    byte a = slateBlue.A;
    string text = String.Format("Slate Blue has these ARGB values: Alpha:{0}, " +
        "red:{1}, green: {2}, blue {3}", new object[]{a, r, g, b});
    e.Graphics.DrawString(text, 
        new Font(this.Font, FontStyle.Italic), 
        new SolidBrush(slateBlue), 
        new RectangleF(new PointF(0.0F, 0.0F), this.Size));
}

Si applica a

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