C
C#3y ago
ero

❔ Dynamically change position of checkboxes?

i'm guessing this is winforms? use a TableLayoutPanel
9 Replies
ero
eroOP3y ago
you don't shift the columns, no you rarely ever want to use absolute values with a tlp, you can set the column widths and row heights to auto which will make them adjust to what's currently inside of them you can add a margin to each cell (or maybe to what's inside of it? don't remember) to have some extra space maybe you need to use padding instead of margin idk if you then set the visibility of the groupbox to hidden, the column will adjust accordingly sure that's a tlp with 2 rows and 2 columns, where cell 0,0 contains another control (a panel, or another tlp) that has its columnspan set to 2 uhh i don't remember i personally would have put another tlp into that cell with 2 rows and 1 column and just stacked the checkboxes like that what do you mean? you seem to have made a mistake you're not meat to make the entire table 2 rows high you put another table (or grid, if that makes more sense to you) into one of the cells basically splitting only that one cell into more cells the same can be achieved by making the entire grid 2 rows high and simply giving all other controls a rowspan of 2 rowspan and columnspan basically meaning how many that specific control occupies yup and now you need to play with the docking and anchoring of the controls again, try to use absolute values as little as possible this will allow you to resize your window to your heart's content, too this does mean that you need a "root" tlp as well it's a little more awkward at first than just dragging and dropping your controls normally but your UI will actually be resizable and reactive the labels in the statistics groupbox i would make a tlp as well but maybe you don't need to if it's a fixed size anyway for the columns that plot type, data point start and data point end are in, i'd go with some percentages padding to position? oh, misread i would anchor the checkbox left and right
ero
eroOP3y ago
ero
eroOP3y ago
taken from google images just not top left, but left right that will center it vertically in the cell on the checkbox control i suggest sorting your properties alphabetically instead of by category
ero
eroOP3y ago
ero
eroOP3y ago
ero
eroOP3y ago
here's an even better google image lol pretty sure that controls the text position? anchor on all 4 sides ah, alright try dock can never tell the 2 apart do you happen to have autosize disabled? enable it and play with the padding i think that should give you the result you want (padding left and right to be specific) yeah that's the difference between padding and margin margin is outside of the bounds of the control, padding is inside that's why i meant if you check autosize, you would need to add padding left and right to get the same look to your button
ero
eroOP3y ago
because of this little gap here
ero
eroOP3y ago
try to start messing with something that isn't winforms are you use that tlp needs to be there? can't you just put the label into the cell direcly? well everything needs to be auto. the label, the tlp, the tlp column, the parent tlp column the other columns can't take up too much space like if they're all auto then it's gonna break somewhere auto as well or maybe there's like a fit to content (probably not) and the column the gb is in needs to be auto too ¯\_(ツ)_/¯ so not everything was autosize?
Accord
Accord3y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity. Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Did you find this page helpful?