⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module1.bas

📁 用vb制作的冒泡法动画演示过程
💻 BAS
字号:
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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -