PC Review


Reply
Thread Tools Rate Thread

Changing parent container

 
 
Young
Guest
Posts: n/a
 
      10th May 2009
Can someone please help? I am trying to move a panel (standard .NET panels)
control to another panel at run time.

I've 2 panels - Panel1 and Panel2. Both's parent are current the form
container.

When I click on a button, I want to make Panel1 the parent of Panel2. I have
change the background color so I can see what is happening. Also, I make
Panel2 smaller than Panel1 to make sure I can see it in Panel1.

Here are the codes in the button click event:

Panel2.Parent = Panel2
Panel2.BringToFront

When I click on the button, I can see Panel2 is no longer visible and
"possible" moved to Panel1. But I cannot see Panel2 within Panel2.

Can someone please help?

TIA
Young


 
Reply With Quote
 
 
 
 
Pavel Minaev
Guest
Posts: n/a
 
      10th May 2009
On May 9, 9:50*pm, "Young" <young10...@hotmail.com> wrote:
> Can someone please help? I am trying to move a panel (standard .NET panels)
> control to another panel at run time.
>
> I've 2 panels - Panel1 and Panel2. Both's parent are current the form
> container.
>
> When I click on a button, I want to make Panel1 the parent of Panel2. I have
> change the background color so I can see what is happening. Also, I make
> Panel2 smaller than Panel1 to make sure I can see it in Panel1.
>
> Here are the codes in the button click event:
>
> Panel2.Parent = Panel2
> Panel2.BringToFront
>
> When I click on the button, I can see Panel2 is no longer visible and
> "possible" moved to Panel1. But I cannot see Panel2 within Panel2.


After you move the (now child) panel, do you set its Location to
ensure that it is correctly positioned in its parent panel?
 
Reply With Quote
 
Jerónimo Milea
Guest
Posts: n/a
 
      10th May 2009
Hi Young, this is how i will do that:

panel2.Parent = panel1;
panel2.Location = new Point( 10, 10 );
panel2.BringToFront();

Hope that helps
Jerónimo Milea

"Young" <(E-Mail Removed)> escribió en el mensaje de
noticias:4a065cfd$(E-Mail Removed)...
> Can someone please help? I am trying to move a panel (standard .NET
> panels) control to another panel at run time.
>
> I've 2 panels - Panel1 and Panel2. Both's parent are current the form
> container.
>
> When I click on a button, I want to make Panel1 the parent of Panel2. I
> have change the background color so I can see what is happening. Also, I
> make Panel2 smaller than Panel1 to make sure I can see it in Panel1.
>
> Here are the codes in the button click event:
>
> Panel2.Parent = Panel2
> Panel2.BringToFront
>
> When I click on the button, I can see Panel2 is no longer visible and
> "possible" moved to Panel1. But I cannot see Panel2 within Panel2.
>
> Can someone please help?
>
> TIA
> Young
>

 
Reply With Quote
 
Young
Guest
Posts: n/a
 
      12th May 2009
Thanks all for replying.

I did not set the location. It works when I set the location.

Young

"Pavel Minaev" <(E-Mail Removed)> wrote in message
news:4bf2da95-a679-4987-b4e1-(E-Mail Removed)...
On May 9, 9:50 pm, "Young" <young10...@hotmail.com> wrote:
> Can someone please help? I am trying to move a panel (standard .NET
> panels)
> control to another panel at run time.
>
> I've 2 panels - Panel1 and Panel2. Both's parent are current the form
> container.
>
> When I click on a button, I want to make Panel1 the parent of Panel2. I
> have
> change the background color so I can see what is happening. Also, I make
> Panel2 smaller than Panel1 to make sure I can see it in Panel1.
>
> Here are the codes in the button click event:
>
> Panel2.Parent = Panel2
> Panel2.BringToFront
>
> When I click on the button, I can see Panel2 is no longer visible and
> "possible" moved to Panel1. But I cannot see Panel2 within Panel2.


After you move the (now child) panel, do you set its Location to
ensure that it is correctly positioned in its parent panel?


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
In .Net 1.1, how to notify a parent container of a property change? Cartoper Microsoft C# .NET 0 24th Jul 2008 08:25 PM
Dragging a non-MDI child form off its parent container rbaut@ecs Microsoft Dot NET Framework Forms 0 8th Nov 2006 10:48 PM
Container.DataItem of Parent Contol?? Adam Knight Microsoft ASP .NET 0 18th Nov 2005 05:32 AM
Calling parent container' method Danny Ni Microsoft ASP .NET 1 12th Nov 2004 02:40 PM
Retreiving Parent container size Francois Soucy Microsoft VB .NET 5 31st Oct 2003 11:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:06 AM.