Option Explicit On
Option Strict On
Public Class YourGarden01
Dim AppLocation, CurLocation As New Point(0, 0)
Dim wachsen, wasser, dünger As String
Dim anaus As Long
'Die form bewegen ohne Borderstyle
Private CurrentPosition As New System.Drawing.Point
Private MouseButton As System.Windows.Forms.MouseButtons = Nothing
Private Overloads Sub OnMouseDown(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
MyClass.MouseButton = e.Button()
With MyClass.CurrentPosition
.X = e.X()
.Y = e.Y()
End With
End Sub
Private Overloads Sub OnMouseUp(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseUp
MyClass.MouseButton = Nothing
End Sub
Private Overloads Sub OnMouseMove(ByVal Sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
Select Case MyClass.MouseButton
Case Is = Windows.Forms.MouseButtons.Left
MyClass.Top = Windows.Forms.Cursor.Position.Y() - MyClass.CurrentPosition.Y()
MyClass.Left = Windows.Forms.Cursor.Position.X() - MyClass.CurrentPosition.X()
Case Is = Nothing
Exit Sub
End Select
End Sub
Private Sub YourGarden01_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
NotifyIcon1.Visible = True
'---------------
wasser = "0"
dünger = "1000"
wachsen = "0"
anaus = CLng("0")
'---------------
Label1Wasser.Text = My.Settings.Wasser2
Label1wachsen.Text = My.Settings.Wachsen3
'---------------------------
wachsen = Label1wachsen.Text
wasser = Label1Wasser.Text
End Sub
Private Sub Wachsen_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1Wachsen.Tick
wachsen = CStr(CDbl(wachsen) + 1) : Label1wachsen.Text = wachsen : wasser = CStr(CDbl(wasser) - 1) : Label1Wasser.Text = wasser
blume_wachsen_animation()
End Sub
Private Sub BewegenTimer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BewegenTimer1.Tick
'Me.Location = AppLocation - CurLocation + Cursor.Position
End Sub
Private Sub Sync()
AppLocation = Me.Location
CurLocation = Cursor.Position
End Sub
Private Sub Blume001_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Blume001.MouseDoubleClick
Me.Visible = False : NotifyIcon1.Visible = True
End Sub
Private Sub Blume001_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Blume001.MouseDown
Me.BewegenTimer1.Enabled = True
BewegenTimer1.Start()
Sync()
End Sub
Private Sub Blume001_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Blume001.MouseUp
BewegenTimer1.Stop()
Sync()
End Sub
Private Sub BeendenToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BeendenToolStripMenuItem1.Click
My.Settings.Wasser2 = Label1Wasser.Text
My.Settings.Wachsen3 = Label1wachsen.Text
My.Settings.Save()
My.Settings.Reload()
'OK
End
End Sub
Private Sub ZustandToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ZustandToolStripMenuItem.Click
If Me.ZustandToolStripMenuItem.CheckState = CheckState.Checked Then GroupBox1Wasser.Visible = True : GroupBox2Wachsen.Visible = True
If Me.ZustandToolStripMenuItem.CheckState = CheckState.Unchecked Then GroupBox1Wasser.Visible = False : GroupBox2Wachsen.Visible = False
End Sub
Private Sub ZustandToolStripMenuItem_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles ZustandToolStripMenuItem.MouseDown
anaus = anaus + 1
If anaus = 1 Then Me.ZustandToolStripMenuItem.CheckState = CheckState.Checked
If anaus = 2 Then Me.ZustandToolStripMenuItem.CheckState = CheckState.Unchecked : anaus = 0
End Sub
Private Sub ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem1.Click
Timer1Wachsen.Enabled = True
Timer1Wachsen.Start()
Me.ToolStripMenuItem1.Visible = False
End Sub
Private Sub GroupBox2Wachsen_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles GroupBox2Wachsen.MouseDoubleClick
'___Du bist hier_******
GroupBox2Wachsen.Visible = False : Me.ZustandToolStripMenuItem.CheckState = CheckState.Unchecked : anaus = 0
End Sub
Private Sub GroupBox2Wachsen_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles GroupBox2Wachsen.MouseDown
Me.BewegenTimer1.Enabled = True
BewegenTimer1.Start()
Sync()
End Sub
Private Sub GroupBox1Wasser_MouseDoubleClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles GroupBox1Wasser.MouseDoubleClick
GroupBox1Wasser.Visible = False : Me.ZustandToolStripMenuItem.CheckState = CheckState.Unchecked : anaus = 0
End Sub
Private Sub GroupBox1Wasser_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles GroupBox1Wasser.MouseDown
Me.BewegenTimer1.Enabled = True
BewegenTimer1.Start()
Sync()
End Sub
Private Sub GroupBox1Wasser_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles GroupBox1Wasser.MouseUp
BewegenTimer1.Stop()
Sync()
End Sub
Private Sub GroupBox2Wachsen_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles GroupBox2Wachsen.MouseUp
BewegenTimer1.Stop()
Sync()
End Sub
Private Sub NeuAnfangenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NeuAnfangenToolStripMenuItem.Click
Me.Blume001.Image = ImageList1.Images(0)
Me.ToolStripMenuItem1.Visible = True
Me.ZustandToolStripMenuItem.CheckState = CheckState.Unchecked
Me.Label1wachsen.Text = ("0")
Me.Label1Wasser.Text = ("0")
Me.Timer1Wachsen.Stop()
Me.Timer1Wachsen.Enabled = False
'------------------------------------------
wasser = CStr(0)
dünger = CStr(1000)
wachsen = CStr(0)
anaus = 0
My.Settings.Wasser2 = Label1Wasser.Text
My.Settings.Wachsen3 = Label1wachsen.Text
End Sub
Private Sub NotifyIcon1_MouseDoubleClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDoubleClick
Me.Visible = True
End Sub
Private Sub Wachhund_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Wachhund.Tick
If wasser = "" Then
wasser = "0"
Else
End If
If CDbl(wasser) < 100 Then BlumeWässernToolStripMenuItem.Visible = True
If CDbl(wasser) = 100 Then BlumeWässernToolStripMenuItem.Visible = False
If CDbl(wasser) = 0 Then Timer1Wachsen.Enabled = False
If CDbl(wasser) > 0 Then Timer1Wachsen.Enabled = True
' AB HIER IST ES BUGGY ************************************!
If CDbl(Label1wachsen.Text) = 100 Then
ToolStripMenuItem1.Visible = False
Else
ToolStripMenuItem1.Visible = True
End If
If CDbl(Label1Wasser.Text) = 0 Then
BlumeWässernToolStripMenuItem.Visible = False
Else
BlumeWässernToolStripMenuItem.Visible = True
End If
If CDbl(Label1wachsen.Text) = 0 And CDbl(Label1Wasser.Text) = 0 Then
BlumeWässernToolStripMenuItem.Visible = True
ToolStripMenuItem1.Visible = True
Else
End If
' AB HIER IST ES WIEDER OK ************************************!!
'------------------------------------------------
If Label1wachsen.Text = "" Then
Label1wachsen.Text = "0"
Else
End If
blume_wachsen_animation()
End Sub
Sub blume_wachsen_animation()
Select Case Label1wachsen.Text
Case Is <= CStr(0) : Blume001.Image = My.Resources.Flower001
Case Is = CStr(1) : Blume001.Image = My.Resources.Flower002
Case Is = CStr(2) : Blume001.Image = My.Resources.Flower003
Case Is = CStr(3) : Blume001.Image = My.Resources.Flower004
Case Is = CStr(4) : Blume001.Image = My.Resources.Flower005
Case Is = CStr(5) : Blume001.Image = My.Resources.Flower006
Case Is = CStr(6) : Blume001.Image = My.Resources.Flower007
Case Is = CStr(8) : Blume001.Image = My.Resources.Flower008
Case Is = CStr(10) : Blume001.Image = My.Resources.Flower009
Case Is = CStr(12) : Blume001.Image = My.Resources.Flower010
Case Is = CStr(14) : Blume001.Image = My.Resources.Flower011
Case Is = CStr(16) : Blume001.Image = My.Resources.Flower012
Case Is = CStr(18) : Blume001.Image = My.Resources.Flower013
Case Is = CStr(22) : Blume001.Image = My.Resources.Flower014
Case Is = CStr(24) : Blume001.Image = My.Resources.Flower015
Case Is = CStr(26) : Blume001.Image = My.Resources.Flower016
Case Is = CStr(28) : Blume001.Image = My.Resources.Flower017
Case Is = CStr(32) : Blume001.Image = My.Resources.Flower018
Case Is = CStr(34) : Blume001.Image = My.Resources.Flower019
Case Is = CStr(36) : Blume001.Image = My.Resources.Flower020
Case Is = CStr(38) : Blume001.Image = My.Resources.Flower021
Case Is = CStr(42) : Blume001.Image = My.Resources.Flower022
Case Is = CStr(44) : Blume001.Image = My.Resources.Flower023
Case Is = CStr(46) : Blume001.Image = My.Resources.Flower024
Case Is = CStr(48) : Blume001.Image = My.Resources.Flower025
Case Is = CStr(52) : Blume001.Image = My.Resources.Flower026
Case Is = CStr(54) : Blume001.Image = My.Resources.Flower027
Case Is = CStr(56) : Blume001.Image = My.Resources.Flower028
Case Is = CStr(58) : Blume001.Image = My.Resources.Flower029
Case Is = CStr(62) : Blume001.Image = My.Resources.Flower030
Case Is = CStr(64) : Blume001.Image = My.Resources.Flower031
Case Is = CStr(66) : Blume001.Image = My.Resources.Flower032
Case Is = CStr(68) : Blume001.Image = My.Resources.Flower033
Case Is = CStr(72) : Blume001.Image = My.Resources.Flower034
Case Is = CStr(74) : Blume001.Image = My.Resources.Flower035
Case Is = CStr(76) : Blume001.Image = My.Resources.Flower036
Case Is = CStr(78) : Blume001.Image = My.Resources.Flower037
Case Is = CStr(82) : Blume001.Image = My.Resources.Flower038
Case Is = CStr(84) : Blume001.Image = My.Resources.Flower039
Case Is = CStr(86) : Blume001.Image = My.Resources.Flower040
Case Is = CStr(88) : Blume001.Image = My.Resources.Flower041
Case Is = CStr(92) : Blume001.Image = My.Resources.Flower042
Case Is = CStr(94) : Blume001.Image = My.Resources.Flower043
Case Is = CStr(96) : Blume001.Image = My.Resources.Flower044
Case Is = CStr(98) : Blume001.Image = My.Resources.Flower045
Case Is = CStr(100) : Blume001.Image = My.Resources.Flower046
Case Else
'Timer1Wachsen.Enabled = False
End Select
End Sub
Private Sub BlumeWässernToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BlumeWässernToolStripMenuItem.Click
If CDbl(dünger) = 0 Then GoTo 1
If wachsen = "" Then
GoTo 1
Else
End If
dünger = CStr(1000 - CDbl(wachsen))
wasser = CStr(CDbl(wasser) + 100) : dünger = CStr(CDbl(dünger) - 100) : Label1Wasser.Text = wasser
1:
End Sub
Private Sub BlumeDüngenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BlumeDüngenToolStripMenuItem.Click
End Sub
End Class