From 760bdb6eb4cb97d68a08d8e0021cfc76e18c90c6 Mon Sep 17 00:00:00 2001 From: Peter Dennis Bartok Date: Wed, 12 Jan 2005 01:07:20 +0000 Subject: [PATCH] - Improved testing ability, now allows to 'step up' a control in the chain via the middle mouse button svn path=/trunk/winforms/; revision=38752 --- zorder/swf-zorder.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/zorder/swf-zorder.cs b/zorder/swf-zorder.cs index df6caf7..7e01ae0 100644 --- a/zorder/swf-zorder.cs +++ b/zorder/swf-zorder.cs @@ -1,7 +1,7 @@ // -// This is a bit overboard for a test app, but I'm hoping it -// can be gutted and used as a base for other test apps, trying -// to set a good example :-) +// Right-click or left-click to move a label +// into background or foreground respectively +// Middle click to move it one up the chain // @@ -51,12 +51,22 @@ namespace MWFTestApplication { if (child != null) { if (child.Parent != null) { if (verbose > 0) { - Console.WriteLine("Clicked on Label '{0}', moving to {1} of Z-Order", child.Text, e.Button == MouseButtons.Left ? "Bottom" : "Top"); + Console.WriteLine("Clicked on Label '{0}', moving to {1} of Z-Order", child.Text, e.Button == MouseButtons.Left ? "Bottom" : e.Button == MouseButtons.Right ? "Top" : "Middle"); } if (e.Button == MouseButtons.Left) { main_window.Controls.SetChildIndex(child, main_window.Controls.Count); - } else { + } else if (e.Button == MouseButtons.Right) { main_window.Controls.SetChildIndex(child, 0); + } else { + int i; + + i = main_window.Controls.GetChildIndex(child); + if (i > 0) { + i--; + } else { + i = main_window.Controls.Count; + } + main_window.Controls.SetChildIndex(child, i); } } } else {