Ignore:
Timestamp:
Jan 27, 2007, 12:04:09 PM (18 years ago)
Author:
イグトランス (egtra)
Message:

Controlの追加とそれに伴う修正

File:
1 edited

Legend:

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

    r28 r77  
    1818    End Sub
    1919
    20     Sub Rectangle(x As Single, y As Single, width As Single, height As Single)
     20    Sub Rectangle(x As Long, y As Long, width As Long, height As Long)
    2121        x = x
    2222        y = y
     
    2525    End Sub
    2626
    27     Sub Rectangle(location As Point, size As Size)
    28         x = location.X
    29         y = location.Y
    30         width = size.Height
    31         height = size.Height
    32     End Sub
    33 
    34     Sub Rectangle(ByRef rc As Rectangle)
    35         x = rc.x
    36         y = rc.y
    37         width = rc.width
    38         height = rc.height
     27    Sub Rectangle(l As Point, s As Size)
     28        x = l.X
     29        y = l.Y
     30        width = s.Height
     31        height = s.Height
     32    End Sub
     33
     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
     41    Sub Rectangle(ByRef r As RECT)
     42        This = FromLTRB(r.left, r.top, r.right, r.bottom)
    3943    End Sub
    4044
     
    5862    End Sub
    5963
    60     Function X() As Single
     64    Function X() As Long
    6165        Return x
    6266    End Function
    6367
    64     Sub X(value As Single)
     68    Sub X(value As Long)
    6569        x = value
    6670    End Sub
    6771
    68     Function Y() As Single
     72    Function Y() As Long
    6973        Return y
    7074    End Function
    7175
    72     Sub Y(value As Single)
     76    Sub Y(value As Long)
    7377        y = value
    7478    End Sub
    7579
    76     Function Width() As Single
     80    Function Width() As Long
    7781        Return width
    7882    End Function
    7983
    80     Sub Width(value As Single)
     84    Sub Width(value As Long)
    8185        width = value
    8286    End Sub
    8387
    84     Function Height() As Single
     88    Function Height() As Long
    8589        Return height
    8690    End Function
    8791
    88     Sub Height(value As Single)
     92    Sub Height(value As Long)
    8993        height = value
    9094    End Sub
    9195
    92     Function Left() As Single
     96    Function Left() As Long
    9397        Return X
    9498    End Function
    9599
    96     Function Top() As Single
     100    Function Top() As Long
    97101        Return Y
    98102    End Function
    99103
    100     Function Right() As Single
     104    Function Right() As Long
    101105        Return X + Width
    102106    End Function
    103107
    104     Function Bottom() As Single
     108    Function Bottom() As Long
    105109        Return Y + Height
    106110    End Function
     
    144148    End Function
    145149
    146     Static Function FromLTRB(l As Single, t As Single, r As Single, b As Single) As Rectangle
     150    Static Function FromLTRB(l As Long, t As Long, r As Long, b As Long) As Rectangle
    147151        Dim rect As Rectangle(l, t, r - l, r - b)
    148152        return rect
    149153    End Function
    150154
    151     Function Contains(x As Single, y As Single) As BOOL
     155    Function Contains(x As Long, y As Long) As BOOL
    152156        If x >= X And x < X + Width And y >= Y And y < Y + Height Then
    153157            Contains = _System_TRUE
     
    169173    End Function
    170174
    171     Sub Inflate(dx As Single, dy As Single)
     175    Sub Inflate(dx As Long, dy As Long)
    172176        X -= dx
    173177        Y -= dy
     
    180184    End Sub
    181185
    182     Static Function Inflate(ByRef rc As Rectangle, x As Single, y As Single) As Rectangle
     186    Static Function Inflate(ByRef rc As Rectangle, x As Long, y As Long) As Rectangle
    183187        Inflate = rc
    184188        Inflate.Inflate(x, y)
     
    190194
    191195    Static Function Intersect(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle
    192         Dim right As Single, bottom As Single, left As Single, top As Single
     196        Dim right As Long, bottom As Long, left As Long, top As Long
    193197        right = Math.Min(a.Right, b.Right)
    194198        bottom = Math.Min(a.Bottom, b.Bottom)
     
    210214
    211215    Static Function Union(ByRef a As Rectangle, ByRef b As Rectangle) As Rectangle
    212         Dim right As Single, bottom As Single, left As Single, top As Single
     216        Dim right As Long, bottom As Long, left As Long, top As Long
    213217        right = Math.Max(a.Right(), b.Right())
    214218        bottom = Math.Max(a.Bottom(), b.Bottom())
     
    222226    End Sub
    223227
    224     Sub Offset(dx As Single, dy As Single)
     228    Sub Offset(dx As Long, dy As Long)
    225229        X += dx
    226230        Y += dy
     
    254258    End Function
    255259
     260    Function ToRECT() As RECT
     261        With ToRECT
     262            .left = x
     263            .top = y
     264            .right = x + width
     265            .bottom = y + height
     266        End With
     267    End Function
     268
    256269Public
    257     x As Single
    258     y As Single
    259     width As Single
    260     height As Single
     270    x As Long
     271    y As Long
     272    width As Long
     273    height As Long
    261274End Class
    262275
Note: See TracChangeset for help on using the changeset viewer.