📄 modfuntion.bas
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -