SIZE (Structures)
Last changed: -205.228.12.236

.
Summary
The SIZE structure specifies the width and height of a rectangle.

C# Signature:

[StructLayout(LayoutKind.Sequential)]
struct SIZE {
    public int cx;
    public int cy;

    public SIZE(int cx, int cy) {
        this.cx = cx;
        this.cy = cy;
    }

    public Size ToSize() {
        return new Size(cx, cy);
    }

    public static SIZE FromSize(Size sz) {
        return new SIZE(sz.Width, sz.Height);
    }

    public override string ToString() {
        return string.Format("{{Width={0}, Height={1}}}", cx, cy);
    }
}

VB .NET Signature:

<StructLayout(LayoutKind.Sequential)> Structure SIZE
    Public cx As Integer
    Public cy As Integer

    Public Sub New(ByVal cx As Integer, ByVal cy As Integer)
        Me.cx = cx
        Me.cy = cy
    End Sub

    Public Function ToSize() As System.Drawing.Size
        Return New System.Drawing.Size(cx, cy)
    End Function

    Public Shared Function FromSize(ByVal sz As System.Drawing.Size) As SIZE
        Return New Size(sz.Width, sz.Height)
    End Function

    Public Overrides Function ToString() As String
        Return String.Format("{{Width={0}, Height={1}}}", cx, cy)
    End Function
End Structure

Notes:

None.

Tips & Tricks:

Please add some!

Sample Code:

Please add some!

Alternative Managed API:

System.Drawing.Size

System.Drawing.SizeF

Documentation
SIZE on MSDN