12-07-2011, 01:16 PM
Playing With a Label
Screen 1:
Code :
Screen 2 :
Code :
Code :
Code:
Class form1
Dim sz As Integer
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Label1.Text = "Catch me If YOu Can"
Timer1.Interval = 1
sz = 34
Label1.Font = New Font("arial", sz, FontStyle.Bold)
Timer1.Stop()
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim x, y As New Random
Try
Label1.Font = New Font("arial", sz, FontStyle.Bold)
sz -= 1
Catch ex As Exception
sz = 34
Label1.Location = New Point(x.Next(Me.Width \ 2), y.Next(Me.Height \ 2))
Label1.Text = "Im Waiting For You !!"
Label1.Font = New Font("arial", sz, FontStyle.Bold)
Timer1.Stop()
End Try
End Sub
Private Sub Label1_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.MouseEnter
Timer1.Start()
End Sub
End Class
Screen 2 :
Code :
Code:
Public Class Form1
Dim Color As Color
Dim Police As System.Drawing.Font
Dim OFG As Integer = 0
Dim KLM As Boolean = False
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Label1.Text = "Click Button1"
Me.Width = 300
Me.Height = 100
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
'create a Defilent text in The label
If OFG < 220 And Not KLM Then
OFG += 15
Else
KLM = True
End If
Label1.Text = "This Is How You Can play With Label ( Hackforum )-ThePrinCe"
If KLM Then OFG -= 25
If OFG <= 10 Then KLM = False
'Police
police = New Font("arial", Convert.ToSingle(40 - (OFG / 10)))
Label1.Font = police
'Color Of The Text in THe Label
Color = Color.FromArgb(0, OFG, OFG, OFG)
Label1.ForeColor = Color
'Movement Of The text
Label1.Text = Mid(Label1.Text, 1, Label1.Text.Length - 1) & Mid(Label1.Text, 1, 10)
End Sub
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Timer1.Start()
End Sub
End Class