求VB变幻线程序代码,急!!!

求VB变幻线程序代码,急!!!,第1张

下面代码另存为form1.frm,在简明VB中拦兆告打开:

VERSION 5.00

Begin VB.Form Form1

BackColor = &H00000000&

BorderStyle = 0 'None

Caption = "Form1"

ClientHeight= 6675

ClientLeft = 0

ClientTop = 0

ClientWidth = 8445

LinkTopic = "Form1"

ScaleHeight = 6675

ScaleWidth = 8445

ShowInTaskbar = 0 '猜春False

StartUpPosition = 3 '窗口缺省

Begin VB.Timer Timer11

Enabled = 0 'False

Interval= 10

Left= 5880

Top = 3840

End

Begin VB.Timer Timer6

Enabled = 0 'False

Interval= 15

Left= 6600

Top = 2400

End

Begin VB.Timer Timer13

Interval= 10

Left= 6240

Top = 4800

End

Begin VB.Timer Timer12

Interval= 10

Left= 7080

Top = 3840

End

Begin VB.Timer Timer10

Interval= 10

Left= 6480

Top = 3840

End

Begin VB.Timer Timer9

Enabled = 0 'False

Interval= 10

Left= 6480

Top = 3240

End

Begin VB.Timer Timer8

Enabled = 0 'False

Interval= 15

Left= 7200

Top = 2400

End

Begin VB.Timer Timer7

Interval= 10

Left= 6000

Top = 2400

End

Begin VB.Timer Timer5

Interval= 10

Left= 6600

Top = 1800

End

Begin VB.Timer Timer4

Enabled = 0 'False

Interval= 10

Left= 7080

Top = 1080

End

Begin VB.Timer Timer3

Interval= 10

Left= 5880

Top = 1080

End

Begin VB.Timer Timer2

Enabled = 0 'False

Interval= 10

Left= 6480

Top = 1080

End

Begin VB.Timer Timer1

Interval= 10

Left= 6480

Top = 480

End

Begin VB.Line Line3

BorderColor = &H00FF0000&

Index = 6

X1 = 3000

X2 = 240

Y1 = 2040

Y2 = 2160

End

Begin VB.Line Line2

BorderColor = &H00FF0000&

Index = 6

X1 = 1680

X2 = 3000

Y1 = 360

Y2 = 1680

End

Begin VB.Line Line1

BorderColor = &H00FF0000&

Index = 6

X1 = -120

X2 = 1440

Y1 = 1920

Y2 = 240

End

Begin VB.Line Line3

BorderColor = &H00FF0000&

Index = 5

X1 = 3000

X2 = 240

Y1 = 2040

Y2 = 2160

End

Begin VB.Line Line2

BorderColor = &H00FF0000&

Index = 5

X1 = 1680

X2 = 3000

Y1 = 360

Y2 = 1680

End

Begin VB.Line Line1

BorderColor = &H00FF0000&

Index = 5

X1 = -120

X2 = 1440

Y1 = 1920

Y2 = 240

End

Begin VB.Line Line3

BorderColor = &H00FF0000&

Index = 4

X1 = 3000

X2 = 240

Y1 = 2040

Y2 = 2160

End

Begin VB.Line Line2

BorderColor = &H00FF0000&

Index = 4

X1 = 1680

X2 = 3000

Y1 = 360

Y2 = 1680

End

Begin VB.Line Line1

BorderColor = &H00FF0000&

Index = 4

X1 = -120

X2 = 1440

Y1 = 1920

Y2 = 240

End

Begin VB.Line Line3

BorderColor = &H00FF0000&

Index = 3

X1 = 3000

X2 = 240

Y1 = 2040

Y2 = 2160

End

Begin VB.Line Line2

BorderColor = &H00FF0000&

Index = 3

X1 = 1680

X2 = 3000

Y1 = 360

Y2 = 1680

End

Begin VB.Line Line1

BorderColor = &H00FF0000&

Index = 3

X1 = -120

X2 = 1440

Y1 = 1920

Y2 = 240

End

Begin VB.Line Line1

BorderColor = &H00FF0000&

Index = 2

X1 = -120

X2 = 1440

Y1 = 1920

Y2 = 240

End

Begin VB.Line Line2

BorderColor = &H00FF0000&

Index = 2

X1 = 1680

X2 = 3000

Y1 = 360

Y2 = 1680

End

Begin VB.Line Line3

BorderColor = &H00FF0000&

Index = 2

X1 = 3000

X2 = 240

Y1 = 2040

Y2 = 2160

End

Begin VB.Line Line1

BorderColor = &H00FF0000&

Index = 1

X1 = 3120

X2 = 4680

Y1 = 2280

Y2 = 600

End

Begin VB.Line Line2

BorderColor = &H00FF0000&

Index = 1

X1 = 4920

X2 = 6240

Y1 = 720

Y2 = 2040

End

Begin VB.Line Line3

BorderColor = &H00FF0000&

Index = 1

X1 = 6240

X2 = 3480

Y1 = 2400

Y2 = 2520

End

Begin VB.Line Line3

BorderColor = &H00FF0000&

Index = 0

X1 = 4080

X2 = 1320

Y1 = 4680

Y2 = 4800

End

Begin VB.Line Line2

BorderColor = &H00FF0000&

Index = 0

X1 = 2760

X2 = 4080

Y1 = 3000

Y2 = 4320

End

Begin VB.Line Line1

BorderColor = &H00FF0000&

Index = 0

X1 = 960

X2 = 2520

Y1 = 4560

Y2 = 2880

End

End

Attribute VB_Name = "Form1"

Attribute VB_GlobalNameSpace = False

Attribute VB_Creatable = False

Attribute VB_PredeclaredId = True

Attribute VB_Exposed = False

Dim x1, x2, x3, y1, y2, y3

Private Sub Form_DblClick()

End

End Sub

Private Sub Form_Load()

Me.Top = 0

Me.Left = 0

Me.Width = Screen.Width

Me.Height = Screen.Height

x1 = Line1(0).x1

y1 = Line1(0).y1

x2 = Line2(0).x1

y2 = Line2(0).y1

x3 = Line3(0).x1

y3 = Line3(0).y1

End Sub

Private Sub Timer1_Timer()

y1 = y1 - 50

If y1 <= 0 Then

Timer1 = False

Timer2 = True

End If

End Sub

Private Sub Timer13_Timer()

Line1(0).x1 = x1

Line1(0).y1 = y1

Line3(0).x2 = Line1(0).x1

Line3(0).y2 = Line1(0).y1

Line2(0).x1 = x2

Line2(0).y1 = y2

Line1(0).x2 = Line2(0).x1

Line1(0).y2 = Line2(0).y1

Line3(0).x1 = x3

Line3(0).y1 = y3

Line2(0).x2 = Line3(0).x1

Line2(0).y2 = Line3(0).y1

For a = 1 To 6

Line1(a).x1 = Line1(a - 1).x1 - 100

Line1(a).y1 = Line1(a - 1).y1 - 100

Line3(a).x2 = Line1(a).x1

Line3(a).y2 = Line1(a).y1

Line2(a).x1 = Line2(a - 1).x1 - 100

Line2(a).y1 = Line2(a - 1).y1 - 100

Line1(a).x2 = Line2(a).x1

Line1(a).y2 = Line2(a).y1

Line3(a).x1 = Line3(a - 1).x1 - 100

Line3(a).y1 = Line3(a - 1).y1 - 100

Line2(a).x2 = Line3(a).x1

Line2(a).y2 = Line3(a).y1

Next a

End Sub

Private Sub Timer2_Timer()

y1 = y1 + 50

If y1 >= Me.Height Then

Timer2 = False

Timer1 = True

End If

End Sub

Private Sub Timer3_Timer()

x1 = x1 - 50

If x1 <= 0 Then

Timer3 = False

Timer4 = True

End If

End Sub

Private Sub Timer4_Timer()

x1 = x1 + 50

If x1 >= Me.Width Then

Timer4 = False

Timer3 = True

End If

End Sub

Private Sub Timer5_Timer()

y2 = y2 - 50

If y2 <= 0 Then

Timer5 = False

Timer6 = True

End If

End Sub

Private Sub Timer6_Timer()

y2 = y2 + 50

If y2 >= Me.Height Then

Timer6 = False

Timer5 = True

End If

End Sub

Private Sub Timer7_Timer()

x2 = x2 - 50

If x2 <= 0 Then

Timer7 = False

Timer8 = True

End If

End Sub

Private Sub Timer8_Timer()

x2 = x2 + 50

If x2 >= Me.Width Then

Timer8 = False

Timer7 = True

End If

End Sub

Private Sub Timer9_Timer()

y3 = y3 - 50

If y3 <= 0 Then

Timer9 = False

Timer10 = True

End If

End Sub

Private Sub Timer10_Timer()

y3 = y3 + 50

If y3 >= Me.Height Then

Timer10 = False

Timer9 = True

End If

End Sub

Private Sub Timer11_Timer()

x3 = x3 - 50

If x3 <= 0 Then

Timer11 = False

Timer12 = True

End If

End Sub

Private Sub Timer12_Timer()

x3 = x3 + 50

If x3 >= Me.Width Then

Timer12 = False

Timer11 = True

End If

End Sub

4.6 程序调试

1. VB的调试工具

(1)设置自动语法检查

枣樱 打开工具菜单 → 单击选项命令 → 选择 我器 页面 →将 自动语法检测 勾上。

(2)利用VB调试工具栏

 利用该工具栏可以运行程序、中断运行、在程序中设置间断点、监视变量、单步调试、过程跟踪等 *** 作。

2. VB的三种模式

(1)设计模式

 在设计模式下可以进行程序的界面设计、属性设置、代码编写等,标题栏上显示“设计”,在此模式下不能运行程序,也不能使用调试工具。

(2)运行模式

 执行“运行”菜单中的“启动”命令或单击工具栏上的启动按钮或按F5键,即由设计模式进入运行模式,标题栏显示“运行”,在此阶段可以查看程序代码,但不能修改。若要修改,必须单雀咐击工具栏上的“结束”按钮,回到设计模式,也可以选择“中断”按钮,进入中断模式。

(3)中断模式

当程序凳岁丛运行时单击了“中断”按钮,或当程序出现运行错误时,都可以进入中断模式,在此模式下,运行的程序被挂起,可以查看代码、修改代码、检查数据。修改结束,单击“继续”按钮可以继续程序的运行,也可以单击“结束”按钮停止程序的执行。

3. 常见错误

(1) 我时错误

当用户在代码窗口我代码时,VB会对程序进行语法检查,当发现语句没有输完、关键字输错等情况时,系统会d出对话框,提示出错,并在错误处加亮显示,以便用户修改。

(2)编译时错误

是指用户单击了“启动”按钮,VB开始运行程序前,先编译执行的程序段时产生的错误,此错误是由于用户未定义变量、遗漏关键字等原因而产生的。发现错误时系统会停止编译,提示用户修改。

(3)运行时错误

指VB在编译通过后,运行代码时发生的错误,一般是由于指令代码执行了非法 *** 作引起的,如:数据类型不匹配、试图打开一个不存在的文件等。系统会报错并加亮显示、等候处理。

(4)逻辑错误

如果程序运行后得不到所希望的结果,则说明存在逻辑错误。如:运算符使用不正确,语句的次序不对、循环语句的起始、终值不正确。这种错误系统不会报错,需要用户自己分析判断。


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/yw/12326453.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-24
下一篇 2023-05-24

发表评论

登录后才能评论

评论列表(0条)

保存