Export (0) Print
Expand All

Size.op_Implicit Method

Converts the specified Size to a SizeF.

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

public static implicit operator SizeF (
	Size p
)
Not applicable.

Parameters

p

The Size to convert.

Return Value

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

private void ShowPropertiesOfSlateBlue(PaintEventArgs e)
{
    Color slateBlue = Color.FromName("SlateBlue");
    ubyte g = slateBlue.get_G();
    ubyte b = slateBlue.get_B();
    ubyte r = slateBlue.get_R();
    ubyte a = slateBlue.get_A();
    String text = String.Format(
        "Slate Blue has these ARGB values: Alpha:{0}, "  
        + "red:{1}, green: {2}, blue {3}", 
        new Object[] { (UInt16)a, (UInt16)r, (UInt16)g, (UInt16)b });

    e.get_Graphics().DrawString(text, 
        new Font(this.get_Font(), FontStyle.Italic), 
        new SolidBrush(slateBlue), 
        new RectangleF(new PointF(0, 0), 
        Size.op_Implicit(this.get_Size())));
} //ShowPropertiesOfSlateBlue

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft