Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# Windows .NET
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 31-Dec-12 0:35am
Comments
Sergey Alexandrovich Kryukov at 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

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hay Dennis,
 
you can use DevExpress Layout Control instead of this
 
Kindly let me know if you have any query
  Permalink  
Comments
URVISHSUTHAR at 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)

  Print Answers RSS
0 OriginalGriff 562
1 Sergey Alexandrovich Kryukov 484
2 Maciej Los 325
3 DamithSL 233
4 Mathew Soji 195
0 OriginalGriff 7,168
1 Sergey Alexandrovich Kryukov 6,377
2 DamithSL 5,461
3 Manas Bhardwaj 4,876
4 Maciej Los 4,450


Advertise | Privacy | Mobile
Web04 | 2.8.1411023.1 | Last Updated 1 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100