listbox will disappear from my form when I resized the form

  • Thread starter Thread starter Claudia Fong
  • Start date Start date
C

Claudia Fong

Hiya,

the listbox will disappear from my form when I resized the form.. is
there a way to prevent it? I want the listbox to auto resize when I
resize the form..


Cheers!

Claudi
 
the listbox will disappear from my form when I resized the form.. is
there a way to prevent it? I want the listbox to auto resize when I
resize the form..

So do you mean that when you grab one of the edges of your form and change
its size by even a single pixel, the list box suddenly vanishes?
 
No, it disappear let says when you resize the half the original size...


Cheers!

Claudi
 
Claudia,

Have a look at the dock and/or the anchor properties of the listbox (or
better any control)

Cor
 
I tried listBox1.Anchor = AnchorStyles.Right;

listBox1.Anchor = AnchorStyles.Bottom;
listBox1.Anchor = AnchorStyles.Top;
listBox1.Anchor = AnchorStyles.Left;

And it still being cut off when resizing the form...

Don't understand..

Cheers!

Claudi
 
I tried listBox1.Anchor = AnchorStyles.Right;

listBox1.Anchor = AnchorStyles.Bottom;
listBox1.Anchor = AnchorStyles.Top;
listBox1.Anchor = AnchorStyles.Left;

And it still being cut off when resizing the form...

Don't understand..

It sounds like, for example, you have some controls on the left side of the
form and a list box on the right side of the form. When you make the form
narrower, you want these controls to resize proportionately so that they all
remain visible. I don't think you can do this with the Anchor property;
instead I believe you either need to use one of the layout controls that
were introduced in Windows Forms 2.0, like FlowLayoutPanel or
TableLayoutPanel, or else you'll need to do it the old-fashioned way and
write resizing code yourself. I've never used the two controls I just
mentioned, so I can't tell you much about them or if they'll even work. I
can tell you that the "manual" approach always works, but it's definitely
more effort.
 
You mean that the box becomes so small after resizing that there cannot be
any box anymore?

Probably is the dock property what you are searching for.

Cor
 
Back
Top