System.Windows.Forms.ToolStripMenuItem.GetTopLevelControl C# (CSharp) 메소드

GetTopLevelControl() 개인적인 메소드

private GetTopLevelControl ( ) : Control
리턴 Control
		Control GetTopLevelControl ()
		{
			ToolStripItem item = this;
			while (item.OwnerItem != null)
				item = item.OwnerItem;

			if (item.Owner == null)
				return null;

			if (item.Owner is ContextMenuStrip) {
				Control container = ((ContextMenuStrip)item.Owner).container;
				return container == null ? null : container.TopLevelControl;
			}

			// MainMenuStrip
			return item.Owner.TopLevelControl;
		}