作业帮 > 综合 > 作业

vb :请问各位大侠,以下代码每句都是什么意思呀.小弟才疏学浅,实在是不知道我.

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/11/08 23:04:06
vb :请问各位大侠,以下代码每句都是什么意思呀.小弟才疏学浅,实在是不知道我.
Private FormOldWidth As Long
Private FormOldHeight As Long
Public Sub resizeinit(FormName As Form)
Dim Obj As Control
FormOldWidth = FormName.ScaleWidth
FormOldHeight = FormName.ScaleHeight
On Error Resume Next
For Each Obj In FormName
Obj.Tag = Obj.Left & " " & Obj.Top & " " & Obj.Width & " " & Obj.Height & " "
Next Obj
On Error GoTo 0
End Sub
Public Sub ResizeForm(FormName As Form)
Dim Pos(4) As Double
Dim i As Long,TempPos As Long,StartPos As Long
Dim Obj As Control
Dim ScaleX As Double,ScaleY As Double
ScaleX = FormName.ScaleWidth / FormOldWidth
ScaleY = FormName.ScaleHeight / FormOldHeight
On Error Resume Next
For Each Obj In FormName
StartPos = 1
For i = 0 To 4
TempPos = InStr(StartPos,Obj.Tag," ",vbTextCompare)
If TempPos > 0 Then
Pos(i) = Mid(Obj.Tag,StartPos,TempPos - StartPos)
StartPos = TempPos + 1
Else
Pos(i) = 0
End If
Obj.Move Pos(0) * ScaleX,Pos(1) * ScaleY,Pos(2) * ScaleX,Pos(3) * ScaleY
Next i
Next Obj
On Error GoTo 0
End Sub
Private Sub Form_Resize()
Call ResizeForm(Me)
End Sub
gxhbsx