Solved

How to avoid being child of control?

Posted on 2007-03-30
3
280 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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

13 Experts available now in Live!

Get 1:1 Help Now