Click here to Skip to main content
15,867,453 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've put labels and other controls like buttons and comboboxes into a panel. My idea is to go through the labels by scrolling vertically, so it's something like two long columns at the bottom of the panel. Thing is, whenever I scroll every control keeps on being repainted, which causes lag and it appears like lines and I also can see in the task manager that the memory the application is using keeps increasing. Is there a possibility to save the state of the controls without them being repainted when I'm scrolling in the panel and fix the lag in general?

What I have tried:

I've tried multiple solutions like double buffering and others that other forums recommend, but they don't seem to be working.
Posted
Updated 31-May-22 21:17pm

1 solution

Without your code, we can't tell - but I'd start by looking at the Panel Paint event handler if you have one, and the actual scroll code you are using - if you call Invalidate on the panel or any container (such as a Form) that contains it, all the controls within it are being redrawn.
 
Share this answer
 
Comments
Marie Iv 1-Jun-22 4:05am    
I tested out the elements from the form which were basically made in the designer (without adding code to them), turns out if only the labels and two of the buttons (they are not functioning yet) are in the panel there is no lag at all and the memory is okay too. But when the comboboxes are included (they are using a database), the form starts acting weird. I'm going to attach the code. I'm sorry if it's messy, I'm a beginner in coding and I'm new here also.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900