GetRECT模块.bas
资源名称:vbmcrisrc.rar [点击查看]
上传用户:pcw2004
上传日期:2022-02-02
资源大小:743k
文件大小:1k
源码类别:
DirextX编程
开发平台:
Visual Basic
- Attribute VB_Name = "GetRECT模块"
- Option Explicit
- ' Download by http://www.codefans.net
- Public Sub GetRect(Width As Integer, Height As Integer, ByRef intTileX As Long, ByRef intTileY As Long, ByRef RectTile As RECT)
- '设置区域
- With RectTile
- .Left = 0
- .Right = .Left + Width
- .Top = 0
- .bottom = .Top + Height
- '左边
- If intTileX < 0 Then
- .Left = .Left - intTileX
- intTileX = 0
- End If
- '右边
- If intTileX + TILE_WIDTH > SCREEN_WIDTH Then .Right = .Right + (SCREEN_WIDTH - (intTileX + TILE_WIDTH))
- '上边
- If intTileY < 0 Then
- .Top = .Top - intTileY
- intTileY = 0
- End If
- '下边
- If intTileY + TILE_HEIGHT > SCREEN_HEIGHT Then .bottom = .bottom + (SCREEN_HEIGHT - (intTileY + TILE_HEIGHT))
- If .Left <= 0 Then .Left = 0
- If .Left >= Width Then .Left = Width
- If .Right <= .Left Then .Right = .Left
- If .Right >= Width Then .Right = Width
- If .Top <= 0 Then .Top = 0
- If .Top >= Height Then .Top = Height
- If .bottom <= .Top Then .bottom = .Top
- If .bottom >= Height Then .bottom = Height
- End With
- End Sub