Click to See Complete Forum and Search --> : Listbox created at runtime makes problems


cabasm
May 14th, 2008, 07:17 AM
On a groupbox control I add at runtime a listbox control. But only the part of the listbox inside the groupbox is displayed. I need to show the whole listbox control even it the listbox is bigger than the parent groupbox. I call the BringToFront( ) method on the listbox object but it doesn't help.
If I create the listbox by adding it at design time, it is displayed correctly even if the listbox is bigger than the parent groupbox.
How can i resolve this problem?

Thanks!

MikeVallotton
May 14th, 2008, 07:30 AM
Resize the groupbox.

groupbox.Size.Width = listbox.Size.Width;
groupbox.Size.Height = listbox.Size.Height;

cabasm
May 14th, 2008, 08:31 AM
I don't want to resize the parent groupbox. I want to display the listbox as it is, even it is bigger (listbox's height is bigger than it's parent height) than the parent groupbox.

MikeVallotton
May 14th, 2008, 09:18 AM
Then resize the listbox.

Or am I just missing something?

darwen
May 14th, 2008, 12:28 PM
Parent windows clip their children.

So if you have a window (listbox) which is bigger than its parent (groupbox) then the parent (groupbox) will clip the child window.

So what you're trying to do won't work.

Darwen.