Sliding effect issue in VB.NET
-
I have written a code to give a sliding effect to 5 command buttons. It runs fine with default background but when i change the opacity of the form OR put a picture in the background it behaves slower rather much slower than what it does normally. What might be the issue? Any ideas to resolve it. Here is the code.
Public Class Form1
Dim slidevar As Integer = -10
Dim slidevar1 As Integer = -60
Dim slidevar2 As Integer = -120
Dim slidevar3 As Integer = -180
Dim slidevar4 As Integer = -240
Dim delayvar As Integer = -300
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadButton1.Location = New Point(-1000, 10) Button2.Location = New Point(-1000, 80) Button3.Location = New Point(-1000, 120) Button4.Location = New Point(-1000, 160) Button5.Location = New Point(-1000, 200) End Sub Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End Sub Private Sub Button\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button.Click slidevar = 0 slidevar1 = 0 slidevar2 = 0 slidevar3 = 0 slidevar4 = 0 Button1.Location = New Point(-1000, 10) Button2.Location = New Point(-1000, 80) Button3.Location = New Point(-1000, 120) Button4.Location = New Point(-1000, 160) Button5.Location = New Point(-1000, 200) Timer1.Enabled = True End Sub Private Sub Timer1\_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If slidevar < 65 Then Button1.Location = New Point(slidevar, 10) slidevar += 6 If slidevar4 > 65 Then Timer1.Enabled = False End If End If For delayvar = 1 To 100 Next If slidevar1 < 65 Then Button2.Location = New Point(slidevar1, 80) slidevar1 += 5 End If For delayvar = 1 To 100 Next If slidevar2 < 65 Then Button3.Location = New Point(slidevar2, 120) slidevar2 += 4 End If For delayvar = 1 To 100 Next If slidevar3 < 65 Then Button4.Location = New Point(slidevar3, 160) slidevar3 += 3 End If For delayvar = 1 To 100
-
I have written a code to give a sliding effect to 5 command buttons. It runs fine with default background but when i change the opacity of the form OR put a picture in the background it behaves slower rather much slower than what it does normally. What might be the issue? Any ideas to resolve it. Here is the code.
Public Class Form1
Dim slidevar As Integer = -10
Dim slidevar1 As Integer = -60
Dim slidevar2 As Integer = -120
Dim slidevar3 As Integer = -180
Dim slidevar4 As Integer = -240
Dim delayvar As Integer = -300
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadButton1.Location = New Point(-1000, 10) Button2.Location = New Point(-1000, 80) Button3.Location = New Point(-1000, 120) Button4.Location = New Point(-1000, 160) Button5.Location = New Point(-1000, 200) End Sub Private Sub Button1\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click End Sub Private Sub Button\_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button.Click slidevar = 0 slidevar1 = 0 slidevar2 = 0 slidevar3 = 0 slidevar4 = 0 Button1.Location = New Point(-1000, 10) Button2.Location = New Point(-1000, 80) Button3.Location = New Point(-1000, 120) Button4.Location = New Point(-1000, 160) Button5.Location = New Point(-1000, 200) Timer1.Enabled = True End Sub Private Sub Timer1\_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick If slidevar < 65 Then Button1.Location = New Point(slidevar, 10) slidevar += 6 If slidevar4 > 65 Then Timer1.Enabled = False End If End If For delayvar = 1 To 100 Next If slidevar1 < 65 Then Button2.Location = New Point(slidevar1, 80) slidevar1 += 5 End If For delayvar = 1 To 100 Next If slidevar2 < 65 Then Button3.Location = New Point(slidevar2, 120) slidevar2 += 4 End If For delayvar = 1 To 100 Next If slidevar3 < 65 Then Button4.Location = New Point(slidevar3, 160) slidevar3 += 3 End If For delayvar = 1 To 100
you have already asked this question in QA[^] What have you tried since then?
Lobster Thermidor aux crevettes with a Mornay sauce, served in a Provençale manner with shallots and aubergines, garnished with truffle pate, brandy and a fried egg on top and Spam - Monty Python Spam Sketch