예제 #1
0
        private void KillTooltip()
        {
            // Do not want timer to fire again
            _hoverTimer.Stop();

            // Check if there is anything to kill
            if (_popupTooltip != null)
            {
                // Remove the tooltip
                _popupTooltip.Close();
                _popupTooltip.Dispose();
                _popupTooltip = null;

                // No longer cache associated command
                _tooltipCmdState = null;
            }
        }
예제 #2
0
        private void OnMouseHoverTick(object sender, EventArgs e)
        {
            // Do not want timer to fire again
            _hoverTimer.Stop();

            // Only interested if no button is being pressed
            if (Control.MouseButtons == MouseButtons.None)
            {
                // Only interested if mouse has not moved
                if (Control.MousePosition == _hoverPoint)
                {
                    // Find any command the mouse is over
                    CommandState commandOver = CommandStateFromPoint(PointToClient(Control.MousePosition), false);

                    // Was a command found?
                    if (commandOver != null)
                    {
                        // Only interesed if the tooltip has a interesting value
                        if (commandOver.Command.Tooltip.Length > 0)
                        {
                            // Cache which command the popup is for
                            _tooltipCmdState = commandOver;

                            // Create a tooltip control using same style as our own
                            _popupTooltip = new PopupTooltipSingle(this.Style);

                            // Define string for display
                            _popupTooltip.ToolText = commandOver.Command.Tooltip;

                            // Make it visible but without taking the foucs
                            _popupTooltip.ShowWithoutFocus(new Point(Control.MousePosition.X, Control.MousePosition.Y + 24));
                        }
                    }
                }
            }
        }