Slide effect on a panel without that lag

Asked

Viewed 236 times

1

My question is the following: How do I remove that lag that causes when a Panel/Button (etc) is updated by the method Controle.Update()? That’s why I use it to make the slide effect, but this effect ta with a low performance resulting in a slow animation and ugly. Here’s my code, considering Panel2 the panel I want the animation:

 For x% = 0% To +200 Step +4
     Panel2.Width = x : Panel2.Update() 
 Next

but it’s no use, I want a beautiful animation, no lag, smooth, like a mobile menu. Any idea?

  • 1

    Good evening Cyberpotato This occurs in the Release or only in Debug?

  • Yes, it occurs in Release mode too.

1 answer

1

Hello, Cyberpotato! I tested your code and did not present any lag... Is your Panel inside some other component? Make sure that the Panel is not in some image... this generates a lot of lag. Do not use the "Update" property for this type of task. Note the example below.

For x = 0 To 100

    Panel2.Width = x
Next
  • He’s inside no component, he’s on the side of a WebBrowser, then Resize’s time also changes the size of the WebBrowser, and that’s the problem. It contains about 6 buttons inside it too, it affects?

  • Whatever is inside your Panel, or whatever is contained will cause lag, but there is a property in your Form that you can change to gain some stability. Click on the form and go to the property: Doublebuffered and leave TRUE.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.