Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

SIZE (Structures)
 
.
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

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Find References
Show Printable Version
Revisions