System.Windows.Forms.Control.FindRootParent C# (CSharp) Method

FindRootParent() private method

private FindRootParent ( ) : Control
return Control
		internal Control FindRootParent ()
		{
			Control	c = this;
			
			while (c.Parent != null)
				c = c.Parent;

			return c;
		}

Usage Example

        static public bool TrackPopupMenu(Menu menu, Point pnt)
        {
            if (menu.MenuItems.Count <= 0)              // No submenus to track
            {
                return(true);
            }

            MenuTracker tracker = menu.tracker;

            tracker.active       = true;
            tracker.popup_active = true;

            // Set GrabControl
            Control src_ctrl = (tracker.TopMenu as ContextMenu).SourceControl;

            tracker.GrabControl = src_ctrl.FindForm();
            if (tracker.GrabControl == null)
            {
                tracker.GrabControl = src_ctrl.FindRootParent();
            }
            //tracker.GrabControl.ActiveTracker = tracker;


            menu.Wnd          = new PopUpWindow(tracker.GrabControl, menu);
            menu.Wnd.Location = menu.Wnd.PointToClient(pnt);
            //((PopUpWindow)menu.Wnd).ShowWindow ();

            bool no_quit = true;

            //Object queue_id = XplatUI.StartLoop(Thread.CurrentThread);



            if (tracker.GrabControl.IsDisposed)
            {
                return(true);
            }

            //if (!no_quit)
            //	XplatUI.PostQuitMessage(0);

            if (menu.Wnd != null)
            {
                menu.Wnd.Dispose();
                menu.Wnd = null;
            }

            return(true);
        }
All Usage Examples Of System.Windows.Forms.Control::FindRootParent
Control