Ignore:
Timestamp:
Apr 30, 2007, 1:56:57 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

Controlがコンパイルできるように修正

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Include/Classes/System/Drawing/Rectangle.ab

    r212 r223  
    44#define __SYSTEM_DRAWING_RECTANGLE_AB__
    55
    6 #include <Classes/System/Math.ab>
    7 #include <Classes/System/Drawing/RectangleF.ab>
    8 #include <Classes/System/Drawing/Point.ab>
    9 #include <Classes/System/Drawing/Size.ab>
     6#require <Classes/System/Math.ab>
     7#require <Classes/System/Drawing/RectangleF.ab>
     8#require <Classes/System/Drawing/Point.ab>
     9#require <Classes/System/Drawing/Size.ab>
    1010
    1111Class Rectangle
     
    3232    End Sub
    3333
    34     Sub Rectangle(ByRef r As Rectangle)
    35         x = r.x
    36         y = r.y
    37         width = r.width
    38         height = r.height
    39     End Sub
    40 
    4134    Sub Rectangle(ByRef r As RECT)
    42         This = FromLTRB(r.left, r.top, r.right, r.bottom)
     35        x = r.left
     36        y = r.top
     37        width = r.right - r.left
     38        height = r.top - r.bottom
    4339    End Sub
    4440
     
    111107
    112108    Function IsEmpty() As Boolean
    113         If Width <= 0 Or Height <= 0 Then
    114             IsEmpty = _System_TRUE
    115         Else
    116             IsEmpty = _System_FALSE
    117         End If
    118     End Function
    119 /*
    120     Function Operator = (rc As Rectangle)
    121         With rc
    122             x = .x
    123             y = .y
    124             width = .width
    125             height = .height
    126         End With
    127     End Function
    128 */
     109        Return Width <= 0 Or Height <= 0
     110    End Function
     111
    129112    Function Operator == (rc As Rectangle)
    130113        Return Equals(rc)
     
    140123
    141124    Function Equals(rc As Rectangle) As Boolean
    142         If X = rc.X And Y = rc.Y And Width = rc.Width And Height = rc.Height Then
    143             Return True
    144         Else
    145             Return False
    146         End If
     125        Return X = rc.X And Y = rc.Y And Width = rc.Width And Height = rc.Height
    147126    End Function
    148127
    149128    Override Function GetHashCode() As Long
    150         Return x Xor _System_BSwap(y) Xor width Xor _System_BSwap(height)
     129        Return x As DWord Xor _System_BSwap(y As DWord) Xor width As DWord Xor _System_BSwap(height As DWord)
    151130    End Function
    152131
    153132    Static Function FromLTRB(l As Long, t As Long, r As Long, b As Long) As Rectangle
    154         return New Rectangle(l, t, r - l, r - b)
     133        return New Rectangle(l, t, r - l, b - t)
    155134    End Function
    156135
    157136    Function Contains(x As Long, y As Long) As Boolean
    158         If x >= X And x < X + Width And y >= Y And y < Y + Height Then
    159             Return True
    160         Else
    161             Return False
    162         End If
     137        Return x >= X And x < X + Width And y >= Y And y < Y + Height
    163138    End Function
    164139
     
    168143
    169144    Function Contains(rc As Rectangle) As Boolean
    170         If X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom Then
    171             Return True
    172         Else
    173             Return False
    174         End If
     145        Return X <= rc.X And rc.Right <= Right And Y <= rc.Y And rc.Bottom <= Bottom
    175146    End Function
    176147
     
    205176
    206177    Function IntersectsWith(rc As Rectangle) As Boolean
    207         If Left < rc.Right And _
     178        Return Left < rc.Right And _
    208179            Top < rc.Bottom And _
    209180            Right > rc.Left And _
    210             Bottom > rc.Top Then
    211             Return True
    212         Else
    213             Return False
    214         End If
     181            Bottom > rc.Top
    215182    End Function
    216183
Note: See TracChangeset for help on using the changeset viewer.