PC Review


Reply
Thread Tools Rate Thread

Add Controls seems to need to be done in reverse?

 
 
William Stacey
Guest
Posts: n/a
 
      8th Dec 2003
Adding three text boxes to a panel and Left docking them to each other. It
seems they need to be added to the panel control in reverse order or else
tb3 will appear before tb2, etc. Even if the position is defined with tb1
at 0,0 and so on. Is this behavior documented or some reason for this? TIA
this.panel1.Controls.Add(this.textBox3);
this.panel1.Controls.Add(this.textBox2);
this.panel1.Controls.Add(this.textBox1);

--
William Stacey, MVP



 
Reply With Quote
 
 
 
 
Ying-Shen Yu[MSFT]
Guest
Posts: n/a
 
      9th Dec 2003
Hi William,

Thanks for your post!

This is an "By Design" issue.
After much debation, our product team decided to use z-order as the docking
order,
internally the controls are docked from bottom to top in z-order, and the
ControlsCollection is considered to be in z-order (top control first), so
you need add controls in reverse order if you want to dock them.

Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.

 
Reply With Quote
 
William Stacey
Guest
Posts: n/a
 
      10th Dec 2003
Thank you Ying-Shen.

--
William Stacey, MVP

""Ying-Shen Yu[MSFT]"" <v-(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi William,
>
> Thanks for your post!
>
> This is an "By Design" issue.
> After much debation, our product team decided to use z-order as the

docking
> order,
> internally the controls are docked from bottom to top in z-order, and the
> ControlsCollection is considered to be in z-order (top control first), so
> you need add controls in reverse order if you want to dock them.
>
> Thanks!
>
> Best regards,
>
> Ying-Shen Yu [MSFT]
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
>
> This posting is provided "AS IS" with no warranties and confers no rights.
> This mail should not be replied directly, "online" should be removed

before
> sending.
>



 
Reply With Quote
 
Pete Davis
Guest
Posts: n/a
 
      10th Dec 2003
The order of adding them affects the tab order of the controls, I believe.
For this same reason, it would also affect the docking if they're docked
together. As far as I know, this isn't documented. I would recommend
downloading Anakrino and looking at the actual System.Windows.Forms code.
There's a lot of undocumented functionality and the only real way to
understand what's going on is to look at the code.

Pete

"William Stacey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Adding three text boxes to a panel and Left docking them to each other.

It
> seems they need to be added to the panel control in reverse order or else
> tb3 will appear before tb2, etc. Even if the position is defined with tb1
> at 0,0 and so on. Is this behavior documented or some reason for this?

TIA
> this.panel1.Controls.Add(this.textBox3);
> this.panel1.Controls.Add(this.textBox2);
> this.panel1.Controls.Add(this.textBox1);
>
> --
> William Stacey, MVP
>
>
>



 
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
Controls.Count, Controls.IsSynchronized, and Controls.SyncRoot Nathan Sokalski Microsoft ASP .NET 4 5th Sep 2007 04:27 AM
Reverse Legend order when select "Categories in reverse order" =?Utf-8?B?TWNqYW5l?= Microsoft Powerpoint 1 18th Mar 2006 06:23 PM
Message box breaks owner draw controls in .NET controls used as ActiveX controls (again) Clive Dixon Microsoft Dot NET Framework Forms 0 26th May 2004 10:15 AM
Matrix Reverse with row identification to reverse bas PJ Karaffa Microsoft Excel Worksheet Functions 4 3rd Feb 2004 05:19 AM
How to force the child controls OnClick event before the parent controls CreateChildControls method? Arulraja Microsoft ASP .NET 3 17th Oct 2003 05:22 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:39 PM.