CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2002
    Posts
    98

    Listbox created at runtime makes problems

    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!

  2. #2
    Join Date
    Mar 2008
    Posts
    72

    Re: Listbox created at runtime makes problems

    Resize the groupbox.

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

  3. #3
    Join Date
    Feb 2002
    Posts
    98

    Re: Listbox created at runtime makes problems

    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.

  4. #4
    Join Date
    Mar 2008
    Posts
    72

    Re: Listbox created at runtime makes problems

    Then resize the listbox.

    Or am I just missing something?

  5. #5
    Join Date
    Jan 2002
    Location
    Scaro, UK
    Posts
    5,940

    Re: Listbox created at runtime makes problems

    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.
    www.pinvoker.com - PInvoker - the .NET PInvoke Interface Exporter for C++ Dlls.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured