Ignore:
Timestamp:
Mar 31, 2009, 2:09:07 PM (16 years ago)
Author:
イグトランス (egtra)
Message:

GDI+をコンパイルできるように修正。FontFamily, Penの追加。サンプルとして、Step 32のGDI+版を制作。
(#56)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/ablib/src/Classes/System/Drawing/Size.ab

    r473 r698  
    44Namespace Drawing
    55
    6 Class Size
    7 Public
    8     Sub Size()
    9         width = 0
    10         height = 0
    11     End Sub
    12 
    13     Sub Size(initWidth As Long, initHeight As Long)
    14         width = initWidth
    15         height = initHeight
    16     End Sub
    17 
    18     Sub Size(sz As Size)
    19         width = sz.width
    20         height = sz.height
    21     End Sub
    22 
    23     Function Width() As Long
    24         Return width
    25     End Function
    26 
    27     Sub Width(w As Long)
    28         width = w
    29     End Sub
    30 
    31     Function Height() As Long
    32         Return height
    33     End Function
    34 
    35     Sub Height(h As Long)
    36         height = h
    37     End Sub
    38 
    39     Function Operator +(sz As Size) As Size
    40         Return New Size(width + sz.width, height + sz.height)
    41     End Function
    42 
    43     Function Operator -(sz As Size) As Size
    44         Return New Size(width - sz.width, height - sz.height)
    45     End Function
    46 
    47     Function Operator () As SizeF
    48         Return New SizeF(width, height)
    49     End Function
    50 
    51     Function Operator ==(sz As Size) As Boolean
    52         Return Equals(sz)
    53     End Function
    54 
    55     Function Operator <>(sz As Size) As Boolean
    56         Return Not Equals(sz)
    57     End Function
    58 
    59     Function Equals(sz As Size) As Boolean
    60         If width = sz.width And height = sz.height Then
    61             Equals = True
    62         Else
    63             Equals = False
    64         End If
    65     End Function
    66 
    67     Override Function GetHashCode() As Long
    68         Return width As DWord Xor _System_BSwap(height As DWord)
    69     End Function
    70 
    71     Function IsEmpty() As Boolean
    72         Return width = 0 And height = 0
    73     End Function
    74 
    75     Function Add(sz As Size) As Size
    76         Return This + sz
    77     End Function
    78 
    79     Function Subtract(sz As Size) As Size
    80         Return This - sz
    81     End Function
    82 
    83     Static Function Ceiling(szf As SizeF) As Size
    84         Return New Size(System.Math.Ceiling(szf.Width) As Long, System.Math.Ceiling(szf.Height) As Long)
    85     End Function
    86 
    87     Static Function Round(szf As SizeF) As Size
    88         Return New Size(System.Math.Round(szf.Width) As Long, System.Math.Round(szf.Height) As Long)
    89     End Function
    90 
    91     Static Function Truncate(szf As SizeF) As Size
    92         Return New Size(System.Math.Truncate(szf.Width) As Long, System.Math.Truncate(szf.Height) As Long)
    93     End Function
    94 
    95 Private
    96     width As Long
    97     height As Long
    98 End Class
     6Type Size
     7    Width As Long
     8    Height As Long
     9End Type
    9910
    10011End Namespace
Note: See TracChangeset for help on using the changeset viewer.