module1.bas

来自「用vb制作的冒泡法动画演示过程」· BAS 代码 · 共 27 行

BAS
27
字号
Attribute VB_Name = "Module1"
Option Explicit

Public Sub DrawRec(x1, y1 As Integer, x2, y2 As Integer)
Form1.Picture1.Line (x1, y1)-(x2, y2), , BF

End Sub

Public Sub DrawLine() '画水平线
Form1.Picture1.DrawWidth = 5
Form1.Picture1.DrawStyle = 6
Form1.Picture1.ForeColor = vbBlack
Form1.Picture1.Line (10, 85)-(110, 85)

End Sub

Public Sub delay(ByVal n As Single) '设计延时函数,n表示需要延时的秒数
  Dim tm1 As Single, tm2  As Single
  tm1 = Timer  '返回一个 Single,代表从午夜开始到现在经过的秒数。
  Do
    tm2 = Timer  '如果tm2<tm1,说明tm1恰好在午夜前,而tm2在午夜后,相差24小时
    If tm2 < tm1 Then tm2 = tm2 + 86400
    If tm2 - tm1 > n Then Exit Do
       DoEvents  'DoEvents 会将控制权传给操作系统。
  Loop
  End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?