I have to make a lot of retangular boxes to make my program neat but i'm having a problem of adding boxes. I tried using the draw event in the tab page but everytime i scroll it will draw the lines again and messes up everything. Also when making a line greater that the tab page, autoscroll won't work.
Is there a way to make lines or boxes in design time?
I would use Labels(AutoSize=False, for resizing) instead of Panels. Maybe even a PictureBox.
.The reason for Labels/PictureBoxes, is that a Panel is a container, not just a basic control. I'm personally uncertain if it takes more out of an app. to load/design/draw a Panel, than it would to do the same for a Label/PictureBox, but since the Panel is a more complex control overall, my guesses are that it will use up more resources.
I'd say it depends on how much "design" you're doing. Panels are good for single complex graphics (think background picture) and are generally easier to configure/maintain than labels and pictureboxes.
HOWEVER panels DO incur a performance overhead, and they have the annoyance of grabbing controls for children, whether you want that or not. If you're worried about overhead and/or you have a lot of overlapping controls, go with the Label/Picturebox.
If you're basically painting your UI though, it's time to look at a custom control specifically tailored to your needs, as this will be (significantly) less overhead and you can tweak its features precisely.
As these panels are making rectangular boxes, I will end up putting labels inside of them. Program doesn't seem sluggish with these panels. I'm more worried about another form that contains more than 150 comboboxes
For Each ctrl As Control In Me.Controls("pnlMainPanel").Controls
If ctrl.GetType Is GetType(System.Windows.Forms.Panel) Then
For Each subCtrl As Control In ctrl.Controls
If subCtrl.GetType Is GetType(System.Windows.Forms.TextBox) Then
If subCtrl.GetType Is ...