Werid problem

If you need help with a project or need to know how to do something specific in VB.NET then please ask your questions in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
11 posts Page 1 of 2
Contributors
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Werid problem
muttley1968
Well basically i would like to make a panel bounce up and down when a user clicks a button that they shouldnt i want the form to move up and down a few times say 6 and then stop back at it original place now i thought to do this with simple

panel.height += 5
panel.height -= 5


but that just make the image inside the panel flicker to such an exctent that you are unable to see the actually bounce its self soo does anyone have any ideas thank you
User avatar
PayneStudios
Dedicated Member
Dedicated Member
Posts: 66
Joined: Thu Sep 15, 2011 2:05 pm

Re: Werid problem
PayneStudios
Try to set Form Probertie "Double Buffered" to "true".
Can also be done with this in Me.Load Event:
Code: Select all
Me.DoubleBuffered = True
Greetz PayneStudios
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: Werid problem
muttley1968
i did forget to mention i do that on all program auto now soo it is on just checked as well it still flickers but do you have any ideas about a diffrent way to code it rather then the one posted above
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Werid problem
Dummy1912
flickers is always a pain in the b.tt
you can always try to create a antiflicker panel with custom
class.

or maybe use the paint event.
to be honest there are not much solutions to fix this bug.
but you can make it less.
tell me about your panels
do they have a image into it? are they set as background or just image with picturebox.
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: Werid problem
muttley1968
it has a background image and inside the panel it has one more panel docked to the bottom of it with some information labels in that.

i did try adding anouther panel but with its visbility to false and then make it true when it was bouncing but same problem it just a white blur :(
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Werid problem
Dummy1912
hello,

can you send me a little of your code
so i can test this.
i have made a sample
but i need your code to test.
thanks
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: Werid problem
muttley1968
Code: Select all
    Dim CursX As Integer = 0
    Dim CursY As Integer = 0
    Private WithEvents Resize_Form_B As New Timer
    Dim AppHeight As Integer = 0
#Region "Definitions"

    Private Sub Definitions()
        CursX = Cursor.Position.X
        CursY = Cursor.Position.Y
        AppHeight = Panel1.Height
    End Sub

#End Region
    Private Sub Resize_Form_B_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Resize_Form_B.Tick
        Panel1.Height = AppHeight - CursY + Cursor.Position.Y
    End Sub
    Private Sub Panel3_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel3.MouseDown
        Resize_Form_B.Enabled = True
        Resize_Form_B.Start()
        Definitions()
    End Sub

    Private Sub Panel3_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel3.MouseUp
        Resize_Form_B.Stop()
        Definitions()
    End Sub

    Private Sub Timer1_Tick_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
         Panel1.Height + = 5 
         Panel1.Height - = 5 
         Panel1.Height + = 5 
         Panel1.Height - = 5 
         Panel1.Height + = 5 
         Panel1.Height - = 5 
            timer1.enabled = false
        End If
    End Sub
This is the code i have put the bit at the top is just a resize the panel with a little less lag it does work if you are moving it with the mouse but when you do it with that code it does lag alot like amazingly alot
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: Werid problem
muttley1968
thanks for the help people i reached the low point and asked my dad for help to wich he looked and said i was a retard and put in
Code: Select all
  
 If Panel1.Height = Me.Height - 10 Then
            bounce2.Enabled = False
            bounce3.Enabled = True
        Else
            System.Threading.Thread.Sleep(100)
            Panel1.Height -= 10
        End If
and fair play works a treat and just put in about 5 timers to doo it soo simple and lag free
User avatar
Dummy1912
VIP - Donator
VIP - Donator
Posts: 1969
Joined: Sat Aug 21, 2010 2:17 pm

Re: Werid problem
Dummy1912
great to hear
i don't have to ask my dad or mom
because they don't known anything about programing :lol:

whats bounce stand for?
you still need the non flicker panel?
visit us on:


http://www.softpedia.com/get/System/Lau ... -Run.shtml
Check it out ! http://www.softpedia.com/publisher/I-A- ... 90017.html
Check it out ! http://www.softpedia.com/get/Desktop-En ... lock.shtml
User avatar
muttley1968
Hardcore Programmer
Hardcore Programmer
Posts: 622
Joined: Thu Jun 17, 2010 11:54 pm

Re: Werid problem
muttley1968
no but thanks for all the help mate really great and i kinda lucky my dad is a computer expert but thanks anyways man +rep yh :P
11 posts Page 1 of 2
Return to “Coding Help & Support”