selecting controls in designer

Poppa Mintin

Well-known member
Joined
Jan 4, 2018
Messages
45
Programming Experience
10+
Do you know at design time what you need and where? If not then creating them at run time is fair enough. The fact that you say that you have 24 PictureBoxes in a TableLayoutPanel seems to suggest that the number and location doesn't vary though, so why would you not add them in the designer? Anything you know at design time should be done in the designer.

John, is there a way to select a whole bunch of the same control in order to change a parameter for each, without having to select each one individually ?
I know I can see the list in the properties dialogue, but I can't find a way to select more than one item at a time.

In the quoted incidence there were only 24 picture boxes, fair enough, a click on each isn't too arduous but when there are (say) 200 plus controls, scattered among many other controls and they're physically small on the screen, selecting one and missing... clicking the TableLayoutPanel instead maybe, means having to start again if you don't happen notice it at the time. Very aggravating !


Poppa.
 
Yes of course, but if you only want (say) labels when they're all mixed in with a load of (say) buttons a lasso ain't gonna help.
This is not a fight you're going to win. Have you ever used Windows Explorer to select multiple files? You can click one to select it, then Ctrl+Click another to select it as well, then Ctrl+Click another to select it as well and so on. It doesn't matter where in the list these files are. Similarly, Ctrl+Click lets you select multiple controls in the WinForms designer regardless of how they are mixed up with other controls. Ctrl+Click even lets you deselect one selected control, so if the controls you want are the majority then you can start by selecting all controls and then Ctrl+Click the ones you don't want.
 
I'm sorry, I have to disagree, that just doesn't work. Ah, well, yes it works in the designer, but that's not what I asked. I was hoping to do it in the properties dialogue, where I have plenty of area to click.

I've spent two days now clicking on every item of a bunch in the designer in order to change them all instead of doing them individually as I add them, even adding them as a copy still doesn't enable all the parameters to be set as they're added.
For instance, I wanted to add a load of panels to use as space around a whole load of labels (I can't just leave the surrounding cells empty because I want to change the colour of the spaces individually), if I set the Dock to Fill, as I want them, I then have to move each one to it's correct cell in a TableLayoutPanel by changing it's cell manually after it's been added.
But if I leave the Dock at None as the panel is added, I can place it in the correct cell with the mouse much more easily, but then I have to select all of them to change their Dock to Fill. Try selecting a panel 40px wide by 14px high, with it's Dock set to Fill and with it's top and bottom Margins both set to 5px. (Ah well!, you can't do it if the dock is 'Fill'.) Then do it for another 324 panels and another 315 vertical panels with the same dimensions (Width and Height: swapped, Left and Right margins) ! (not to mention 176 14x14px PictureBoxes)
I could've done the lot in an hour or two in code.

I have to admit that the form does load much more quickly this way.

Hmm, it's a bit late now... I just realised I ought to've left all the TLP cells as the same percent, giving me all biggish squares, and then once populated, set the rows and columns. (Oh bother !) I hope I remember that next time. (If there's a next time).

Poppa.
 
Thread split to "selecting controls in designer", this is different topic than "How do I get the RectangleF of a control ?"
 
Ok John H, That's a good idea, thanks for letting me know.

Poppa.
 
Back
Top