1 Public Class Form1
Public Class Form1
2 Dim gfxobj As System.Drawing.Graphics
    Dim gfxobj As System.Drawing.Graphics
3 Dim count As Integer
    Dim count As Integer
4 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
5 Handles MyBase.Load
                        Handles MyBase.Load
6 gfxobj = pnlDraw.CreateGraphics()
        gfxobj = pnlDraw.CreateGraphics()
7 Timer1.Enabled = False
        Timer1.Enabled = False
8 lblSpeed.Text = "Current Fill Speed = " & trbSpeed.Value & " ms"
        lblSpeed.Text = "Current Fill Speed = " & trbSpeed.Value & " ms"
9 count = 0
        count = 0
10 End Sub
    End Sub
11 Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
12 If Not gfxobj Is Nothing Then
        If Not gfxobj Is Nothing Then
13 gfxobj.Dispose()
            gfxobj.Dispose()
14 End If
        End If
15 gfxobj = pnlDraw.CreateGraphics()
        gfxobj = pnlDraw.CreateGraphics()
16 gfxobj.Clear(pnlDraw.BackColor)
        gfxobj.Clear(pnlDraw.BackColor)
17 End Sub
    End Sub
18 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
19 Dim newBrush As Brush
        Dim newBrush As Brush
20 newBrush = New SolidBrush(Color.Blue)
        newBrush = New SolidBrush(Color.Blue)
21 If count < 180 Then
        If count < 180 Then
22 gfxobj.FillRectangle(newBrush, 31, 298 - count, 98, 1)
            gfxobj.FillRectangle(newBrush, 31, 298 - count, 98, 1)
23 count = count + 1
            count = count + 1
24 Else
        Else
25 Timer1.Enabled = False
            Timer1.Enabled = False
26 StopWaterFall()
            StopWaterFall()
27 End If
        End If
28 End Sub
    End Sub
29 Private Sub trbSpeed_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles trbSpeed.Scroll
    Private Sub trbSpeed_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles trbSpeed.Scroll
30 Timer1.Interval = trbSpeed.Value
        Timer1.Interval = trbSpeed.Value
31 lblSpeed.Text = "Current Fill Speed = " & trbSpeed.Value & " ms"
        lblSpeed.Text = "Current Fill Speed = " & trbSpeed.Value & " ms"
32 End Sub
    End Sub
33 Sub DrawBeaker()
    Sub DrawBeaker()
34 Dim newPen = New Pen(Color.White, 2)
        Dim newPen = New Pen(Color.White, 2)
35 gfxobj.DrawLine(newPen, 30, 300, 130, 300)
        gfxobj.DrawLine(newPen, 30, 300, 130, 300)
36 gfxobj.DrawLine(newPen, 30, 100, 30, 300)
        gfxobj.DrawLine(newPen, 30, 100, 30, 300)
37 gfxobj.DrawLine(newPen, 130, 100, 130, 300)
        gfxobj.DrawLine(newPen, 130, 100, 130, 300)
38 End Sub
    End Sub
39 Sub DrawWaterFall()
    Sub DrawWaterFall()
40 Dim newBrush As Brush
        Dim newBrush As Brush
41 newBrush = New SolidBrush(Color.Blue)
        newBrush = New SolidBrush(Color.Blue)
42 gfxobj.FillRectangle(newBrush, 66, 48, 23, 251)
        gfxobj.FillRectangle(newBrush, 66, 48, 23, 251)
43 End Sub
    End Sub
44 Sub CleanWaterFall()
    Sub CleanWaterFall()
45 Dim newBrush As Brush
        Dim newBrush As Brush
46 newBrush = New SolidBrush(Color.Black)
        newBrush = New SolidBrush(Color.Black)
47 gfxobj.FillRectangle(newBrush, 66, 48, 23, 251)
        gfxobj.FillRectangle(newBrush, 66, 48, 23, 251)
48 End Sub
    End Sub
49 Sub StopWaterFall()
    Sub StopWaterFall()
50 Dim newBrush As Brush
        Dim newBrush As Brush
51 newBrush = New SolidBrush(Color.Black)
        newBrush = New SolidBrush(Color.Black)
52 gfxobj.FillRectangle(newBrush, 66, 48, 23, 71)
        gfxobj.FillRectangle(newBrush, 66, 48, 23, 71)
53 End Sub
    End Sub
54 Sub CleanWater()
    Sub CleanWater()
55 Dim newBrush As Brush
        Dim newBrush As Brush
56 newBrush = New SolidBrush(Color.Black)
        newBrush = New SolidBrush(Color.Black)
57 gfxobj.FillRectangle(newBrush, 31, 118, 98, 181)
        gfxobj.FillRectangle(newBrush, 31, 118, 98, 181)
58 End Sub
    End Sub
59 Private Sub btnRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRestart.Click
    Private Sub btnRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRestart.Click
60 DrawBeaker()
        DrawBeaker()
61 CleanWater()
        CleanWater()
62 DrawWaterFall()
        DrawWaterFall()
63 count = 0
        count = 0
64 Me.Timer1.Enabled = True
        Me.Timer1.Enabled = True
65 End Sub
    End Sub
66 End Class
End Class
67
 Public Class Form1
Public Class Form12
 Dim gfxobj As System.Drawing.Graphics
    Dim gfxobj As System.Drawing.Graphics3
 Dim count As Integer
    Dim count As Integer4
 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _5
 Handles MyBase.Load
                        Handles MyBase.Load6
 gfxobj = pnlDraw.CreateGraphics()
        gfxobj = pnlDraw.CreateGraphics()7
 Timer1.Enabled = False
        Timer1.Enabled = False8
 lblSpeed.Text = "Current Fill Speed = " & trbSpeed.Value & " ms"
        lblSpeed.Text = "Current Fill Speed = " & trbSpeed.Value & " ms"9
 count = 0
        count = 010
 End Sub
    End Sub11
 Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
    Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize12
 If Not gfxobj Is Nothing Then
        If Not gfxobj Is Nothing Then13
 gfxobj.Dispose()
            gfxobj.Dispose()14
 End If
        End If15
 gfxobj = pnlDraw.CreateGraphics()
        gfxobj = pnlDraw.CreateGraphics()16
 gfxobj.Clear(pnlDraw.BackColor)
        gfxobj.Clear(pnlDraw.BackColor)17
 End Sub
    End Sub18
 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick19
 Dim newBrush As Brush
        Dim newBrush As Brush20
 newBrush = New SolidBrush(Color.Blue)
        newBrush = New SolidBrush(Color.Blue)21
 If count < 180 Then
        If count < 180 Then22
 gfxobj.FillRectangle(newBrush, 31, 298 - count, 98, 1)
            gfxobj.FillRectangle(newBrush, 31, 298 - count, 98, 1)23
 count = count + 1
            count = count + 124
 Else
        Else25
 Timer1.Enabled = False
            Timer1.Enabled = False26
 StopWaterFall()
            StopWaterFall()27
 End If
        End If28
 End Sub
    End Sub29
 Private Sub trbSpeed_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles trbSpeed.Scroll
    Private Sub trbSpeed_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles trbSpeed.Scroll30
 Timer1.Interval = trbSpeed.Value
        Timer1.Interval = trbSpeed.Value31
 lblSpeed.Text = "Current Fill Speed = " & trbSpeed.Value & " ms"
        lblSpeed.Text = "Current Fill Speed = " & trbSpeed.Value & " ms"32
 End Sub
    End Sub33
 Sub DrawBeaker()
    Sub DrawBeaker()34
 Dim newPen = New Pen(Color.White, 2)
        Dim newPen = New Pen(Color.White, 2)35
 gfxobj.DrawLine(newPen, 30, 300, 130, 300)
        gfxobj.DrawLine(newPen, 30, 300, 130, 300)36
 gfxobj.DrawLine(newPen, 30, 100, 30, 300)
        gfxobj.DrawLine(newPen, 30, 100, 30, 300)37
 gfxobj.DrawLine(newPen, 130, 100, 130, 300)
        gfxobj.DrawLine(newPen, 130, 100, 130, 300)38
 End Sub
    End Sub39
 Sub DrawWaterFall()
    Sub DrawWaterFall()40
 Dim newBrush As Brush
        Dim newBrush As Brush41
 newBrush = New SolidBrush(Color.Blue)
        newBrush = New SolidBrush(Color.Blue)42
 gfxobj.FillRectangle(newBrush, 66, 48, 23, 251)
        gfxobj.FillRectangle(newBrush, 66, 48, 23, 251)43
 End Sub
    End Sub44
 Sub CleanWaterFall()
    Sub CleanWaterFall()45
 Dim newBrush As Brush
        Dim newBrush As Brush46
 newBrush = New SolidBrush(Color.Black)
        newBrush = New SolidBrush(Color.Black)47
 gfxobj.FillRectangle(newBrush, 66, 48, 23, 251)
        gfxobj.FillRectangle(newBrush, 66, 48, 23, 251)48
 End Sub
    End Sub49
 Sub StopWaterFall()
    Sub StopWaterFall()50
 Dim newBrush As Brush
        Dim newBrush As Brush51
 newBrush = New SolidBrush(Color.Black)
        newBrush = New SolidBrush(Color.Black)52
 gfxobj.FillRectangle(newBrush, 66, 48, 23, 71)
        gfxobj.FillRectangle(newBrush, 66, 48, 23, 71)53
 End Sub
    End Sub54
 Sub CleanWater()
    Sub CleanWater()55
 Dim newBrush As Brush
        Dim newBrush As Brush56
 newBrush = New SolidBrush(Color.Black)
        newBrush = New SolidBrush(Color.Black)57
 gfxobj.FillRectangle(newBrush, 31, 118, 98, 181)
        gfxobj.FillRectangle(newBrush, 31, 118, 98, 181)58
 End Sub
    End Sub59
 Private Sub btnRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRestart.Click
    Private Sub btnRestart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnRestart.Click60
 DrawBeaker()
        DrawBeaker()61
 CleanWater()
        CleanWater()62
 DrawWaterFall()
        DrawWaterFall()63
 count = 0
        count = 064
 Me.Timer1.Enabled = True
        Me.Timer1.Enabled = True65
 End Sub
    End Sub66
 End Class
End Class67

来源:https://www.cnblogs.com/aspxphpjsprb/archive/2007/11/23/969376.html

