Skip to content
This repository has been archived by the owner on Feb 8, 2018. It is now read-only.

Commit

Permalink
- Improved testing ability, now allows to 'step up' a control in the …
Browse files Browse the repository at this point in the history
…chain

  via the middle mouse button

svn path=/trunk/winforms/; revision=38752
  • Loading branch information
Peter Dennis Bartok committed Jan 12, 2005
1 parent 90fc444 commit 760bdb6
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions zorder/swf-zorder.cs
@@ -1,7 +1,7 @@
// //
// This is a bit overboard for a test app, but I'm hoping it // Right-click or left-click to move a label
// can be gutted and used as a base for other test apps, trying // into background or foreground respectively
// to set a good example :-) // Middle click to move it one up the chain
// //




Expand Down Expand Up @@ -51,12 +51,22 @@ class MainWindow : System.Windows.Forms.Form {
if (child != null) { if (child != null) {
if (child.Parent != null) { if (child.Parent != null) {
if (verbose > 0) { 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) { if (e.Button == MouseButtons.Left) {
main_window.Controls.SetChildIndex(child, main_window.Controls.Count); main_window.Controls.SetChildIndex(child, main_window.Controls.Count);
} else { } else if (e.Button == MouseButtons.Right) {
main_window.Controls.SetChildIndex(child, 0); 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 { } else {
Expand Down

0 comments on commit 760bdb6

Please sign in to comment.