Просмотр исходного кода

- Added SendToBack and BringToFront methods

svn path=/trunk/mcs/; revision=33994
Peter Dennis Bartok 21 лет назад
Родитель
Сommit
918f56da8d
1 измененных файлов с 34 добавлено и 1 удалено
  1. 34 1
      mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs

+ 34 - 1
mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs

@@ -29,9 +29,12 @@
 //	Jaak Simm		[email protected]
 //	Jaak Simm		[email protected]
 //	John Sohn		[email protected]
 //	John Sohn		[email protected]
 //
 //
-// $Revision: 1.63 $
+// $Revision: 1.64 $
 // $Modtime: $
 // $Modtime: $
 // $Log: Control.cs,v $
 // $Log: Control.cs,v $
+// Revision 1.64  2004/09/16 23:44:19  pbartok
+// - Added SendToBack and BringToFront methods
+//
 // Revision 1.63  2004/09/11 03:50:00  pbartok
 // Revision 1.63  2004/09/11 03:50:00  pbartok
 // - Added DoDragDrop() [incomplete]
 // - Added DoDragDrop() [incomplete]
 // - Properly implemented 'Visible' handling
 // - Properly implemented 'Visible' handling
@@ -1756,6 +1759,36 @@ namespace System.Windows.Forms
 			return BeginInvokeInternal (method, args);
 			return BeginInvokeInternal (method, args);
 		}
 		}
 
 
+		public void BringToFront() {
+			// Need to update the child list of our parent
+			if ((parent != null) && (parent.child_controls[0]!=this)) {
+				if (parent.child_controls.Contains(this)) {
+					parent.child_controls.SetChildIndex(this, 0);
+				}
+			}
+
+			XplatUI.SetZOrder(this.window.Handle, IntPtr.Zero, true, false);
+
+			if (parent != null) {
+				parent.Refresh();
+			}
+		}
+
+		public void SendToBack() {
+			// Need to update the child list of our parent
+			if ((parent != null) && (parent.child_controls[parent.child_controls.Count-1]!=this)) {
+
+				if (parent.child_controls.Contains(this)) {
+					parent.child_controls.SetChildIndex(this, parent.child_controls.Count);
+				}
+			}
+
+			XplatUI.SetZOrder(this.window.Handle, IntPtr.Zero, false, true);
+			if (parent != null) {
+				parent.Refresh();
+			}
+		}
+
 		public bool Contains(Control ctl) {
 		public bool Contains(Control ctl) {
 			Control current;
 			Control current;