Windows窗体:flowLayoutPanel:如何最好地安排? [英] Windows Forms: flowLayoutPanel: How to best arrange?

查看:312
本文介绍了Windows窗体:flowLayoutPanel:如何最好地安排?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我需要安排一些元素(在这个例子中:标签)并在运行时添加和删除它们。我遇到的最大问题是这些元素需要具有固定位置,例如lblA需要始终为0,0。也许这个插图更有帮助:



AD

BE

CF



但是,这真的让我感到烦恼,tableLayoutPanel应该自动调整大小而不是比需要的宽,所以如果只显示A,C和F它应该是这样的:



A

C

F



现在,如果我添加X,它应该看起来像



AX

C

F



但是,如果我删除A并添加Y,它应该看起来像:



CY

F

X



明白这一点?我可以使用flowLayoutPanel,但不能控制标签的放置位置(只有flowDirection)或使用tableLayoutPanel,例如显示A,C和Z时会出现问题:



A

C

____Z



(__是空的单元格)



Z应始终显示在最后但仍不在第二行。我试过TableLayoutPanelGrowStyle.AddColumns但是,这不是我正在寻找的。



是否有我监督过的flowLayout-或tableLayoutPanel的内置功能?



最好的问候

Dennis

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

推荐答案

Hay Dennis,



您可以使用DevExpress Layout Control而不是这个



如果您有任何疑问,请告诉我
Hay Dennis,

you can use DevExpress Layout Control instead of this

Kindly let me know if you have any query


这篇关于Windows窗体:flowLayoutPanel:如何最好地安排?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆