Click here to Skip to main content
15,886,258 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello all,

I need to arrange a number of elements (in this example: labels) and add and remove them during runtime. The big issue I have is that these elements need to have a "fixed" position, e.g. lblA needs to be always at 0, 0. Maybe this illustration is more helpful:

A D
B E
C F

BUT, and that's really bothering me, the tableLayoutPanel should autosize and not be wider than needed, so if only A, C and F are displayed it should look like this:

A
C
F

Now if I add X, it should look like

A X
C
F

BUT, if I remove A and add Y, it should look like:

C Y
F
X

Get the point? I could use either use a flowLayoutPanel but would not have any control of where the labels will be placed (only flowDirection) or use a tableLayoutPanel and will have a problem when for example A, C and Z are displayed:

A
C
____Z

(__ is an empty cell)

Z should be displayed always last but still not in a second row. I tried TableLayoutPanelGrowStyle.AddColumns but still, this is not what I'm looking for.

Is there any built-in feature of either the flowLayout- or tableLayoutPanel that I've overseen?

Best Regards
Dennis
Posted
Comments
Sergey Alexandrovich Kryukov 31-Dec-12 18:28pm    
Does you panel have fixed or variable number of children? Do some of the children need to be fixed size, or some or all can have sizes defined by the current layout, form size?
—SA

1 solution

Hay Dennis,

you can use DevExpress Layout Control instead of this

Kindly let me know if you have any query
 
Share this answer
 
Comments
[no name] 2-Jan-13 3:27am    
Hey, the stuff from devexpress is looking great, but a subscription plan for about $899 is just too much for an occassional programmer like me :) All that I'd really need is a kind of a forced break after a number of rowsso that the table is continued on the right side, but still with one column. This would solve my problem. Is there any other recommendable (free or more affordable) control out there?
URVISH_SUTHAR1 2-Jan-13 3:30am    
I'm using DevExpress and don't have others now.

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