' Classes/System/Drawing/Size.ab #ifndef __SYSTEM_DRAWING_SIZE_AB__ #define __SYSTEM_DRAWING_SIZE_AB__ #require #require Namespace System Namespace Drawing Class Size Public Sub Size() width = 0 height = 0 End Sub Sub Size(initWidth As Long, initHeight As Long) width = initWidth height = initHeight End Sub Sub Size(sz As Size) width = sz.width height = sz.height End Sub Function Width() As Long Return width End Function Sub Width(w As Long) width = w End Sub Function Height() As Long Return height End Function Sub Height(h As Long) height = h End Sub Function Operator +(sz As Size) As Size Dim ret As Size(width + sz.width, height + sz.height) Return ret End Function Function Operator -(sz As Size) As Size Dim ret As Size(width - sz.width, height - sz.height) Return ret End Function Function Operator () As SizeF Dim szf As SizeF(width, height) Return szf End Function Function Operator ==(sz As Size) As Boolean Return Equals(sz) End Function Function Operator <>(sz As Size) As Boolean Return Not Equals(sz) End Function Function Equals(sz As Size) As Boolean If width = sz.width And height = sz.height Then Equals = _System_TRUE Else Equals = _System_FALSE End If End Function Override Function GetHashCode() As Long Return width As DWord Xor _System_BSwap(height As DWord) End Function Function IsEmpty() As Boolean Return width = 0 And height = 0 End Function Function Add(sz As Size) As Size Return This + sz End Function Function Subtract(sz As Size) As Size Return This - sz End Function Static Function Ceiling(szf As SizeF) As Size Dim sz As Size(Math.Ceiling(szf.width), Math.Ceiling(szf.height)) Return sz End Function Static Function Round(szf As SizeF) As Size Dim sz As Size(Math.Round(szf.width), Math.Round(szf.height)) Return sz End Function Static Function Truncate(szf As SizeF) As Size Dim sz As Size(Math.Truncate(szf.width), Math.Truncate(szf.height)) Return sz End Function Private width As Long height As Long End Class End Namespace 'Drawing End Namespace 'System #endif '__SYSTEM_DRAWING_SIZE_AB__