private void MouseClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { Control child; Point p; p = ((Control)sender).PointToScreen(new Point(e.X, e.Y)); p = main_window.PointToClient(p); child = GetChildAtPoint(p); if (child != null) { if (child.Parent != null) { WalkControls(child.Parent, child, 14, true); } WalkControls(child, child, 14, true); } else { Console.WriteLine("No control found at point"); } } else { this.SelectNextControl(active, true, true, true, true); } }
private void MouseClick(object sender, MouseEventArgs e) { Control child; Point p; p = ((Control)sender).PointToScreen(new Point(e.X, e.Y)); p = main_window.PointToClient(p); child = GetChildAtPoint(p); 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" : e.Button == MouseButtons.Right ? "Top" : "Middle"); } if (e.Button == MouseButtons.Left) { main_window.Controls.SetChildIndex(child, main_window.Controls.Count); } 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 { if (verbose > 0) { Console.WriteLine("No control found at point"); } } }