锚定列表框问题 [英] Anchor listbox problem

查看:76
本文介绍了锚定列表框问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我在SplitContainer面板中有一个Listbox。


我想锚定它以便列表框增长/缩小垂直使用

调整splitcontainer的大小。


这是我的代码

它会使列表框的水平大小几乎与相同大小

作为拆分容器宽度。

_TableList = new MdsListBox();


_TableList.Name =" TableList" ;;

_TableList.Left = 10;

_TableList.Top = 40;

_TableList.Width = 150;

_TableList.Height = 100;

_TableList.Anchor =(AnchorStyles.Left | AnchorStyles.Right |

AnchorStyles.Bottom | AnchorStyles.Top);


我希望保留列表框集的大小。


rotsey

Hi,

I have a Listbox in a Panel of SplitContainer.

I want to anchor it so the listbox grows/shrinks vertically with the
resizing the splitcontainer.

This is my code
What happens is it sizes the listbox horizontally about nearly the same size
as the split container width.
_TableList = new MdsListBox();

_TableList.Name = "TableList";
_TableList.Left = 10;
_TableList.Top = 40;
_TableList.Width = 150;
_TableList.Height = 100;
_TableList.Anchor = (AnchorStyles.Left | AnchorStyles.Right |
AnchorStyles.Bottom | AnchorStyles.Top);

I want the size of the listbox set here retained.

rotsey

推荐答案

我想锚定它,以便列表框与
I want to anchor it so the listbox grows/shrinks vertically with the

调整大小垂直增长/缩小拆分容器。
resizing the splitcontainer.


会发生什么情况,它会使列表框水平调整大约
What happens is it sizes the listbox horizontally about nearly the



相同大小

same size


作为拆分容器宽度。
as the split container width.



如果你只想让它垂直增长,然后向左或向右锚定,

但不是两者。


Marc

If you only want it to grow vertically, then anchor it left or right,
but not both.

Marc


有效.....但不知道为什么


" Marc Gravell < ma ********** @ gmail.comwrote in message

news:ej ************** @ TK2MSFTNGP03.phx.gbl ...
that worked.....but don''t know why

"Marc Gravell" <ma**********@gmail.comwrote in message
news:ej**************@TK2MSFTNGP03.phx.gbl...

我想锚定它以便列表框垂直增长/缩小

调整大小拆分容器。
I want to anchor it so the listbox grows/shrinks vertically with the
resizing the splitcontainer.


会发生什么情况,它会使列表框水平调整大约
What happens is it sizes the listbox horizontally about nearly the



相同大小

same size


作为拆分容器宽度。
as the split container width.



如果你只想让它垂直增长,然后向左或向右锚定,但

不是两者都有。


Marc


If you only want it to grow vertically, then anchor it left or right, but
not both.

Marc



通过锚定它是的,你告诉它要保持左边缘与集装箱左边缘的固定距离,以及右边缘与集装箱的固定距离。是正确的边缘。这意味着它将随着容器水平增长和收缩。如果你不想要跟踪(成长和甩掉)右手边缘,那么就不要把它固定在右边缘。 $ b。 br />

Marc
By anchoring it left | right, you are telling it to keep the left edge a
fixed distance from the container''s left edge, and the right edge a
fixed distance from the container''s right edge. Ihis means that it will
grow and shrink horizontally along with the container. If you don''t want
it to track (grow and shirnk) the right hand edge, then don''t anchor it
to the right hand edge.

Marc


这篇关于锚定列表框问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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