Solved

How to avoid being child of control?

Posted on 2007-03-30
3
283 Views
Last Modified: 2013-11-07
I have a panel that displays only when a certain button is clicked.  While the panel is hidden, there are a couple of text boxes and labels that display.  The textboxes and labels sit on top of the panel.  Once the panel shows, I call bringtofront().  This hides the textboxes and labels.  It all works fine.

I drop a new textbox onto the form, not the panel.  Then I move it on top of the panel.  It should hide when the panel displays and vice versa.  Just as the above controls do.  The problem is that this new textbox acts like a child of the panel once I move it on top of the panel.  The textbox will now hide when the panel hides, rather than the other way around.  Why does that happen?
0
Comment
Question by:brettr
  • 2
3 Comments
 
LVL 85

Expert Comment

by:Mike Tomlinson
ID: 18824643
"I drop a new textbox onto the form, not the panel.  Then I move it on top of the panel."

When you move the TextBox over the Panel and let go, it becomes a child of the Panel.  The cursor changes to indicate this.  It places a small box under the arrow to show that the TextBox will be moved into the Panel.

If you want to position the TextBox without changing the container then use the Location() property and type in the x,y values manually.  This will keep the Form as the container.
0
 

Author Comment

by:brettr
ID: 18824734
That would make it difficult at design time.  I need good design time support for arranging controls that display while the panel is hidden.  

I've figured out how to do it.  Move the panel out of the way and arrange all of your controls that aren't children of the panel.  Then move the panel back on top of them.

You suggestion about location can be used at runtime to ensure the panel is always positioned properly.
0
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 18824741
There's more than one way to skin a cat...   =)
0

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now