The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Size Implicit Conversion (Size to SizeF)


Converts the specified Size structure to a SizeF structure.

Namespace:   System.Drawing
Assembly:  System.Drawing (in System.Drawing.dll)

public static implicit operator SizeF (
	Size p


Type: System.Drawing.Size

The Size structure to convert.

Return Value

Type: System.Drawing.SizeF

The SizeF structure to which this operator converts.

The following code example demonstrates the G, B, R, and A properties of a Color and the Implicit(Size to SizeF) member.

This example is designed to be used with a Windows Form. Paste the code into the form and call the ShowPropertiesOfSlateBlue method from the form's Paint event-handling method, passing e as PaintEventArgs.

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});
        new Font(this.Font, FontStyle.Italic), 
        new SolidBrush(slateBlue), 
        new RectangleF(new PointF(0.0F, 0.0F), this.Size));

.NET Framework
Available since 1.1
Return to top
© 2015 Microsoft