Explicit Conversion (Point to Size)
Collapse the table of content
Expand the table of content

Point Narrowing Conversion (Point to Size)

 

Creates a Size structure with a Width equal to this point's X value and a Height equal to this point's Y value.

Namespace:   System.Windows
Assembly:  WindowsBase (in WindowsBase.dll)

Public Shared Narrowing Operator CType (
	point As Point
) As Size

Parameters

point
Type: System.Windows.Point

The point to convert.

Return Value

Type: System.Windows.Size

A Size structure with a Width equal to this point's X value and a Height equal to this point's Y value.

Because a Size structure cannot be negative, the absolute values of the point's X and Y properties are used.

The following example shows how to explicitly convert a Point into a Size.

Private Function overloadedExplicitOperatorSizeExample() As Size

	Dim point1 As New Point(10, 5)

	' Explicitly converts a Point structure into a Size structure.
	' returnSize has a width of 10 and a height of 5  
	Dim returnSize As Size = CType(point1, Size)

	Return returnSize

End Function

.NET Framework
Available since 3.0
Return to top
Show:
© 2016 Microsoft