Permalink
Browse files

- Improved testing ability, now allows to 'step up' a control in the …

…chain

  via the middle mouse button

svn path=/trunk/winforms/; revision=38752
  • Loading branch information...
1 parent 90fc444 commit 760bdb6eb4cb97d68a08d8e0021cfc76e18c90c6 Peter Dennis Bartok committed Jan 12, 2005
Showing with 15 additions and 5 deletions.
  1. +15 −5 zorder/swf-zorder.cs
View
@@ -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 @@ class MainWindow : System.Windows.Forms.Form {
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 {

0 comments on commit 760bdb6

Please sign in to comment.