View Full Version : Where is a control's Z-Order in (win)Form ?


秦风意动
04-07-2007, 01:34 PM
As I known, a control has a Z-order in it's container in VB6.0.
It's decided a control 's position of the vertical direction,and
we can changed the position with Z-order in my code at the runtime.

but I can't find it in Dotnet's Controls.

when a component is initialized,it happens as follow:

//
TextBox txtName .....
TextBox txtPassword .....

this.controls.add(txtName );
this.controls.add(txtPassword );
//

And then txtName's Z-Order is greater then txtPassword .
If we change txtPassword to the Top in Form Designer,
the code in "Designer.cs" has change:

//
this.controls.add(txtPassword );
this.controls.add(txtName );

//

The problem is :

How can we dynamically change a control's Z-Order in the code at the
runtime?
I have no idea.

Thanks.
-----------------------------------
PS: It's the first time I write some words in English on the Network.
And my English is very poor, but I'll improve it,I'm sure.

t-xguo@prcvap.microsoft.com
04-09-2007, 04:45 AM
Hi,

Unfortunately, I do not think that there is any built-in .net way to do what you want. So, you can't do it directly but have to rearrange all the controls calling SendToFront for each of them, in order.

Sincerely,
GuoXuan
Microsoft Online Support
Microsoft Global Technical Support Center

Get Secure! - www.microsoft.com/security
=====================================================
When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

t-xguo@prcvap.microsoft.com
04-11-2007, 10:22 AM
Hi,

Is there any more question about this topic?

Sincerely,
GuoXuan
Microsoft Online Support
Microsoft Global Technical Support Center

Get Secure! - www.microsoft.com/security
=====================================================
When responding to posts, please "Reply to Group" via your newsreader so that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.