CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2005
    Posts
    66

    BringToFront changes Control order

    Hi,

    I am using numerous panels (let's call them A-panels) which are added on a host panel. To access them I use host.Controls[index]. On the host panel, there are some other panels which should in the foreground. They must be visible, so I call their BringToFront method. Unfortunately this function disorders the A-panels which makes it impossible to index them.

    Is there a way to bring the panels to the front without changing the order in host.Controls?

    gbr

  2. #2
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: BringToFront changes Control order

    Is there a way to bring the panels to the front without changing the order in host.Controls?
    Probably not, why not have a separate list for your "a-panels", and use that list for "indexing"?

    - petter

  3. #3
    Join Date
    Jun 2005
    Posts
    66

    Re: BringToFront changes Control order

    I wanted to have stored their references only once (in host.Controls). If I won't find any solution I must use a separate list...

    gbr

  4. #4
    Join Date
    Apr 2005
    Location
    Norway
    Posts
    3,934

    Re: BringToFront changes Control order

    Well, if you read MSDNs remaks section of Control.ControlCollection.SetChildIndex(...)
    When SetChildIndex is called, the Control referred to by the child parameter is moved to the position specified by newIndex and the other Control references in the Control.ControlCollection are reordered to accommodate the move. The control with an index value of zero is at the top of the z-order, and higher numbers are closer to the bottom.
    .. you'll see that the collection index is related to the z-order.

    - petter

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