modfuntion.bas
来自「中专学校的学生操行分管理系统,包含了网络查询的功能」· BAS 代码 · 共 45 行
BAS
45 行
Attribute VB_Name = "modFunction"
Option Explicit
Public Type Point
X As Long
Y As Long
End Type
Public Type Rectangle
Left As Long
Top As Long
Height As Long
Width As Long
End Type
Public pitStart As Point, pitEnd As Point '鼠标移动开始的点和结束的点
Public recHeader As Rectangle '页首区
Public recFooter As Rectangle '页尾区
'======================================
'判断点是否在一个方形内
'======================================
Public Function PInRec(pit As Point, rec As Rectangle) As Boolean
PInRec = False
If (pit.X >= rec.Left And pit.X <= (rec.Left + rec.Width)) _
And (pit.Y >= rec.Top And pit.Y <= (rec.Top + rec.Height)) Then PInRec = True
End Function
'======================================
'移动Band时对Band的位置合理性进行判断
'======================================
Public Sub MoveMyBand(ByVal Index As Integer, ByVal intBandHeight As Long)
Select Case Index
Case 0
If (recHeader.Top + recHeader.Height) + (pitEnd.Y - pitStart.Y) + 2 * intBandHeight > recFooter.Top Then _
pitEnd.Y = recFooter.Top - ((recHeader.Top + recHeader.Height) + 2 * intBandHeight) + pitStart.Y
If recHeader.Height + (pitEnd.Y - pitStart.Y) < 0 Then pitEnd.Y = pitStart.Y - recHeader.Height
Case 1
If (recFooter.Top - 2 * intBandHeight) + (pitEnd.Y - pitStart.Y) < (recHeader.Top + recHeader.Height) Then _
pitEnd.Y = (recHeader.Top + recHeader.Height) + pitStart.Y - (recFooter.Top - 2 * intBandHeight)
If (pitEnd.Y - pitStart.Y) > recFooter.Height Then _
pitEnd.Y = pitStart.Y + recFooter.Height
End Select
End Sub
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?