VB.NET 1.1 Tutorial - GDI+ - Size and SizeF


Size

A Size stores an ordered pair of integers. A Size object differs to a Point in terms of instead of storing x and y coordinates, a Size stores width and height. By default, GDI+ will interpret the values entered as the amount of pixels on screen.

There a two methods of creating a new Size object.

Public Sub New( ByVal width As Integer, ByVal height As Integer )

This method initializes a new instance of the Size class from the specified dimensions.

  • width - The width component of the new Size.
  • height - The height component of the new Size.

Public Sub New( ByVal pt As Point )

This method initializes a new instance of the Size class from the specified Point object.

SizeF

A SizeF stores an ordered pair of floating-point numbers, typically the width and height of a rectangle. However, unlike the Size structure, there are three methods of creating a new SizeF object.

Public Sub New( ByVal width As Single, ByVal height As Single )

This method initializes a new instance of the SizeF class from the specified dimensions.

  • width - The width component of the new Size.
  • height - The height component of the new Size.

Public Sub New( ByVal pt As PointF )

This method initializes a new instance of the SizeF class from the specified PointF object.

Public Sub New( ByVal size As SizeF )

This method initializes a new instance of the SizeF class from the specified existing SizeF.


References

For more information on the Size structure, visit MSDN at microsoft here.

For more information on the SizeF structure, visit MSDN at microsoft here.

What Next?

Return to the Tutorial Contents.