Exemple #1
0
        internal void UpdateToolTip(RadItem item, Size offset)
        {
            if (this.ShowItemToolTips && item != this.currentlyActiveTooltipItem && this.ToolTip != null)
            {
                if (item == null)
                {
                    this.ToolTip.Hide(this.ownerControl);
                }

                this.ToolTip.Active             = false;
                this.currentlyActiveTooltipItem = item;
                Cursor mouseCursor = Cursor.Current;

                if (this.currentlyActiveTooltipItem != null && mouseCursor != null)
                {
                    this.ToolTip.Active = true;
                    Point mousePosition = Cursor.Position;
                    mousePosition.X += offset.Width;
                    mousePosition.Y += offset.Height;
                    Rectangle rectangle = WindowsFormsUtils.ConstrainToScreenBounds(new Rectangle(mousePosition, onePixel));
                    mousePosition = this.ownerControl.PointToClient(rectangle.Location);
                    string toolTipText = this.currentlyActiveTooltipItem.ToolTipText;


                    Form ownerForm = this.ownerControl.FindForm();
                    if (ownerForm == null)
                    {
                        ITooltipOwner owner = this.ownerControl as ITooltipOwner;
                        while (owner != null)
                        {
                            Control control = owner as Control;
                            if (control != null && owner.Owner == null)
                            {
                                mousePosition = control.PointToClient(rectangle.Location);
                                this.ToolTip.SetToolTip(control, toolTipText);
                                this.ToolTip.Show(toolTipText, control, mousePosition, this.ToolTip.AutoPopDelay);
                                break;
                            }

                            if (owner.Owner == null)
                            {
                                break;
                            }

                            owner = owner.Owner as ITooltipOwner;
                        }
                    }
                    else
                    {
                        this.ToolTip.Show(toolTipText, this.ownerControl, mousePosition, this.ToolTip.AutoPopDelay);
                    }
                }
            }
        }
Exemple #2
0
        public CustomTooltip(ITooltipOwner owner)
        {
            Owner = owner;

            SetStyle(
                ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint |
                ControlStyles.UserPaint | ControlStyles.ResizeRedraw,
                true
            );
            SetStyle(
                ControlStyles.Selectable | ControlStyles.SupportsTransparentBackColor, false
            );

            try {
                BackgroundRenderer = new VisualStyleRenderer(VisualStyleElement.ToolTip.Standard.Normal);
            } catch {
                BackgroundRenderer = null;
            }

            InitializeComponent();
        }
        public CustomTooltip(ITooltipOwner owner)
        {
            Owner = owner;

            SetStyle(
                ControlStyles.Opaque | ControlStyles.AllPaintingInWmPaint |
                ControlStyles.UserPaint | ControlStyles.ResizeRedraw,
                true
                );
            SetStyle(
                ControlStyles.Selectable | ControlStyles.SupportsTransparentBackColor, false
                );

            try {
                BackgroundRenderer = new VisualStyleRenderer(VisualStyleElement.ToolTip.Standard.Normal);
            } catch {
                BackgroundRenderer = null;
            }

            InitializeComponent();
        }