Size.Implicit(Size to SizeF) Operator
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
public:
static operator System::Drawing::SizeF(System::Drawing::Size p);
public static implicit operator System.Drawing.SizeF(System.Drawing.Size p);
static member op_Implicit : System.Drawing.Size -> System.Drawing.SizeF
Public Shared Widening Operator CType (p As Size) As 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 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) );
}
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 Sub ShowPropertiesOfSlateBlue(ByVal e As PaintEventArgs)
Dim slateBlue As Color = Color.FromName("SlateBlue")
Dim g As Byte = slateBlue.G
Dim b As Byte = slateBlue.B
Dim r As Byte = slateBlue.R
Dim a As Byte = slateBlue.A
Dim text As String = _
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(Me.Font, FontStyle.Italic), _
New SolidBrush(slateBlue), _
New RectangleF(New PointF(0.0F, 0.0F), _
Size.op_Implicit(Me.Size)))
End Sub
Product | Versions |
---|---|
.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, 10 |
.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 |
.NET feedback
.NET is an open source project. Select a link to provide feedback: