[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);
}
}
<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
None.
Please add some!
Please add some!