Hi guys, I'm using Panel to store a list of controls (user defined). As I add panels, I set the location of the control based on Panel.Controls.Count before adding it to the panel.
comRec.Location = new Point(comRec.Location.X, panel1.Controls.Count * 25); panel1.Controls.Add(comRec);
Now it works beautifully and looks the way I want. However, as soon as we reach the limit in the window, AutoScroll resolves (what I want). Now, if the user had to scroll to the bottom of the Panel , this would eventually change the location of each control in the panel. Instead of my first comRec.Location (0,0), it is something like (0, -219). Now, when the user adds another comRec object, he creates a HUGE gap between the objects.
My question is what is the best way to account for location changes using the scroll bar and using my add system. I assume that you will have to do something by checking the value of the scrollbar and using it to determine the location.
Also is there a BEST way to display a list of controls? Should I use Panel ?
source share