当前位置: 首页>>代码示例>>C#>>正文


C# Control.ChangeParent方法代码示例

本文整理汇总了C#中System.Windows.Forms.Control.ChangeParent方法的典型用法代码示例。如果您正苦于以下问题:C# Control.ChangeParent方法的具体用法?C# Control.ChangeParent怎么用?C# Control.ChangeParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.Control的用法示例。


在下文中一共展示了Control.ChangeParent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RemoveImplicit

			internal virtual void RemoveImplicit (Control control)
			{
				if (impl_list != null)
				{
					all_controls = null;
					impl_list.Remove (control);
					owner.PerformLayout (control, "Parent");
					owner.OnControlRemoved (new ControlEventArgs (control));
				}
				control.ChangeParent (null);
				//owner.UpdateChildrenZOrder ();
			}
开发者ID:gabfr,项目名称:MonoMac.Windows.Form,代码行数:12,代码来源:Control.Cocoa.cs

示例2: Remove

			public virtual void Remove (Control value)
			{
				if (value == null)
					return;
				
				all_controls = null;
				list.Remove (value);
				
				owner.PerformLayout (value, "Parent");
				owner.OnControlRemoved (new ControlEventArgs (value));
				
				//ContainerControl container = owner.InternalGetContainerControl ();
				//if (container != null) { 
				// Inform any container controls about the loss of a child control
				// so that they can update their active control
				//	container.ChildControlRemoved (value);
				//}
				
				value.ChangeParent (null);
				
				//owner.UpdateChildrenZOrder();
			}
开发者ID:gabfr,项目名称:MonoMac.Windows.Form,代码行数:22,代码来源:Control.Cocoa.cs

示例3: Add

			public virtual void Add (Control value)
			{
				if (value == null)
					return;
				
				Form form_value = value as Form;
				Form form_owner = owner as Form;
				//TODO:
				bool owner_permits_toplevels = true;
				// (owner is MdiClient) || (form_owner != null && form_owner.IsMdiContainer);
				bool child_is_toplevel = value.GetTopLevel ();
				bool child_is_mdichild = false;
				//form_value != null && form_value.IsMdiChild;
				if (child_is_toplevel && !(owner_permits_toplevels && child_is_mdichild))
					throw new ArgumentException ("Cannot add a top level control to a control.", "value");
				/*
				if (child_is_mdichild && form_value.MdiParent != null && form_value.MdiParent != owner && form_value.MdiParent != owner.Parent) {
					throw new ArgumentException ("Form cannot be added to the Controls collection that has a valid MDI parent.", "value");
				}
				*/				
				
				//value.recalculate_distances = true;
				
				if (Contains (value))
				{
					owner.PerformLayout ();
					return;
				}
				
				if (value.parent != null)
				{
					value.parent.Controls.Remove (value);
				}
				
				all_controls = null;
				list.Add (value);
				
				value.ChangeParent (owner);
				
				//value.InitLayout();
				
				//if (owner.Visible)
				//	owner.UpdateChildrenZOrder();
				owner.PerformLayout (value, "Parent");
				owner.OnControlAdded (new ControlEventArgs (value));
			}
开发者ID:gabfr,项目名称:MonoMac.Windows.Form,代码行数:46,代码来源:Control.Cocoa.cs

示例4: AddImplicit

			internal virtual void AddImplicit (Control control)
			{
				if (impl_list == null)
					impl_list = new ArrayList ();
				
				if (AllContains (control))
				{
					owner.PerformLayout ();
					return;
				}
				
				if (control.parent != null)
				{
					control.parent.Controls.Remove (control);
				}
				
				all_controls = null;
				impl_list.Add (control);
				
				control.ChangeParent (owner);
				//control.InitLayout ();
				//if (owner.Visible)
				//	owner.UpdateChildrenZOrder ();
				
				// If we are adding a new control that isn't
				// visible, don't trigger a layout
				if (control.VisibleInternal)
					owner.PerformLayout (control, "Parent");
			}
开发者ID:gabfr,项目名称:MonoMac.Windows.Form,代码行数:29,代码来源:Control.Cocoa.cs

示例5: Add

			public virtual void Add (Control value)
			{
				if (value == null)
					return;

				Form form_value = value as Form;
				Form form_owner = owner as Form;
				bool owner_permits_toplevels = (owner is MdiClient) || (form_owner != null && form_owner.IsMdiContainer);
				bool child_is_toplevel = value.GetTopLevel();
				bool child_is_mdichild = form_value != null && form_value.IsMdiChild;

				if (child_is_toplevel && !(owner_permits_toplevels && child_is_mdichild))
					throw new ArgumentException("Cannot add a top level control to a control.", "value");
				
				if (child_is_mdichild && form_value.MdiParent != null && form_value.MdiParent != owner && form_value.MdiParent != owner.Parent) {
					throw new ArgumentException ("Form cannot be added to the Controls collection that has a valid MDI parent.", "value");
				}
				
				value.recalculate_distances = true;
				
				if (Contains (value)) {
					owner.PerformLayout();
					return;
				}

				if (value.tab_index == -1) {
					int	end;
					int	index;
					int	use;

					use = 0;
					end = owner.child_controls.Count;
					for (int i = 0; i < end; i++) {
						index = owner.child_controls[i].tab_index;
						if (index >= use) {
							use = index + 1;
						}
					}
					value.tab_index = use;
				}

				if (value.parent != null) {
					value.parent.Controls.Remove(value);
				}

				all_controls = null;
				list.Add (value);

				value.ChangeParent(owner);

				value.InitLayout();

				if (owner.Visible)
					owner.UpdateChildrenZOrder();
				owner.PerformLayout(value, "Parent");
				owner.OnControlAdded(new ControlEventArgs(value));
			}
开发者ID:nlhepler,项目名称:mono,代码行数:57,代码来源:Control.cs


注:本文中的System.Windows.Forms.Control.ChangeParent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。