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 operator SizeF (
	Size p
)

Parameters

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.

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;
   array<Object^>^temp0 = {a,r,g,b};
   String^ text = String::Format( "Slate Blue has these ARGB values: Alpha:{0}, "
   "red:{1}, green: {2}, blue {3}", temp0 );
   e->Graphics->DrawString( text, gcnew System::Drawing::Font( this->Font,FontStyle::Italic ), gcnew SolidBrush( slateBlue ), RectangleF(PointF(0.0F,0.0F),this->Size) );
}

.NET Framework
Available since 1.1
Return to top
Show: