ads_header

How To Create Disco Lamp In Visual Studio


How To Create Disco Lamp In Visual Studio



Preview




Hello guys, this time the video is simple enough to create a simple disco light program, where your laptop / PC will display a full screen color and alternately so that it makes it seem like a disco light even more if you apply more devices. Of course this will be very entertaining.

Well, after you create a new project in Microsoft Visual Studio 2010, add a Timer to the form do not forget to set Enabled in the properties section to True. After that double-click Timer1 and enter the following code:





Public Class Form1

    Private Sub Timer_Tick(ByVal sender As System.Object, Byval e As System.EventArgs) Handles Timer1.Tick   
       If Me.BackColor = Color.Aqua Then
       Me.BackColor = Color.Bisque
       ElseIf Me.BackColor = Color.Bisque Then
       Me.BackColor = Color.BlanchedAlmond
       ElseIf Me.BackColor = Color.BlanchedAlmond Then
       Me.BackColor = Color.Brown
       ElseIf Me.BackColor = Color.Brown Then
       Me.BackColor = Color.BurlyWood
       ElseIf Me.BackColor = Color.BurlyWood Then
       Me.BackColor = Color.Chartreuse
       ElseIf Me.BackColor = Color.Chartreuse Then
       Me.BackColor = Color.Cornslik
       ElseIf Me.BackColor = Color.Cornslik Then
       Me.BackColor = Color.DarkBlue
       ElseIf Me.BackColor = Color.DarkBlue Then
       Me.BackColor = Color.DarkGreen
       ElseIf Me.BackColor = Color.DarkGreen Then
       Me.BackColor = Color.Cyan
       ElseIf Me.BackColor = Color.Cyan Then
       Me.BackColor = Color.DarkGoldenrod
       ElseIf Me.BackColor = Color.DarkGoldenrod Then
       Me.BackColor = Color.CadetBlue
       ElseIf Me.BackColor = Color.CadetBlue Then
       Me.BackColor = Color.Gainsboro
       ElseIf Me.BackColor = Color.Gainsboro Then
       Me.BackColor = Color.LightSalmon
       ElseIf Me.BackColor = Color.LightSalmon Then
       Me.BackColor = Color.DarkKhaki
       ElseIf Me.BackColor = Color.DarkKhaki Then
       Me.BackColor = Color.LightSteelBlue
       ElseIf Me.BackColor = Color.LightSteelBlue Then
       Me.BackColor = Color.Red
       ElseIf Me.BackColor = Color.Red Then
       Me.BackColor = Color.Gold
       ElseIf Me.BackColor = Color.Gold Then
       Me.BackColor = Color.Aqua
       End If
    End Sub
End Class


NOTES :

The initial color of my form is Aqua, So the last condition must be the same color that is Aqua, in order to happen repeatedly continuously

For more details, please watch the video below


Powered by Blogger.