protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);

            if (Form.ActiveForm != null)
            {
                XplatUI.SetOwner(this.Handle, Form.ActiveForm.Handle);
            }
        }
        protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);

            if (Application.MWFThread.Current.Context != null && Application.MWFThread.Current.Context.MainForm != null)
            {
                XplatUI.SetOwner(this.Handle, Application.MWFThread.Current.Context.MainForm.Handle);
            }
        }
        public void Show(Control control, Point position, ToolStripDropDownDirection direction)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }

            XplatUI.SetOwner(Handle, control.Handle);
            Show(control.PointToScreen(position), direction);
        }
Пример #4
0
        public void Show(Control control, Point position)
        {
            if (control == null)
            {
                throw new ArgumentNullException("control");
            }

            XplatUI.SetOwner(Handle, control.Handle);
            ShowInternal(control, control.PointToScreen(position), DefaultDropDownDirection);
        }
Пример #5
0
        public void Show(string text, IWin32Window window, int duration)
        {
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }
            if (duration < 0)
            {
                throw new ArgumentOutOfRangeException("duration", "duration cannot be less than zero");
            }

            if (!Active)
            {
                return;
            }

            timer.Stop();

            Control c = (Control)window;

            XplatUI.SetOwner(tooltip_window.Handle, c.TopLevelControl.Handle);

            // If the mouse is in the requested window, use that position
            // Else, center in the requested window
            if (c.ClientRectangle.Contains(c.PointToClient(Control.MousePosition)))
            {
                tooltip_window.Location = Control.MousePosition;
                tooltip_strings[c]      = text;
                HookupControlEvents(c);
            }
            else
            {
                tooltip_window.Location = c.PointToScreen(new Point(c.Width / 2, c.Height / 2));
            }

            // We need to hide our tooltip if the form loses focus, is closed, or is minimized
            HookupFormEvents((Form)c.TopLevelControl);

            tooltip_window.PresentModal((Control)window, text);

            state = TipState.Show;

            if (duration > 0)
            {
                timer.Interval = duration;
                timer.Start();
            }
        }
Пример #6
0
        public void Show(string text, IWin32Window window, Point point, int duration)
        {
            if (window == null)
            {
                throw new ArgumentNullException("window");
            }
            if (duration < 0)
            {
                throw new ArgumentOutOfRangeException("duration", "duration cannot be less than zero");
            }

            if (!Active)
            {
                return;
            }

            timer.Stop();

            Control c = (Control)window;

            Point display_point = c.PointToScreen(Point.Empty);

            display_point.X += point.X;
            display_point.Y += point.Y;

            XplatUI.SetOwner(tooltip_window.Handle, c.TopLevelControl.Handle);

            // We need to hide our tooltip if the form loses focus, is closed, or is minimized
            HookupFormEvents((Form)c.TopLevelControl);

            tooltip_window.Location = display_point;
            tooltip_window.PresentModal((Control)window, text);

            state = TipState.Show;

            if (duration > 0)
            {
                timer.Interval = duration;
                timer.Start();
            }
        }
Пример #7
0
        protected virtual void SetOwnerControl(Control ownerControl)
        {
            var ownerControlHandle = (ownerControl == null) ? IntPtr.Zero : ownerControl.Handle;

            XplatUI.SetOwner(Handle, ownerControlHandle);
        }