Ejemplo n.º 1
0
        //public bool ToolTipShowUp;

        //

        public EngineToolStrip()
            : base()
        {
            ShowItemToolTips = false;
            timer            = new Timer();
            timer.Enabled    = false;
            timer.Interval   = SystemInformation.MouseHoverTime;
            timer.Tick      += new EventHandler(timer_Tick);
            toolTip          = new EngineToolTip();
        }
Ejemplo n.º 2
0
        public static void Update()
        {
            EngineToolTip.UpdateAllInstances();

            var control = GetControlOverCursor();

            if (currentControl != control)
            {
                //end old
                currentControl = null;
                currentControlForm?.Close();
                currentControlForm = null;

                //start new
                if (control != null)
                {
                    (EngineToolTip toolTip, string text)tuple = EngineToolTip.GetToolTipByControl(control);
                    if (tuple.toolTip != null && !string.IsNullOrEmpty(tuple.text))
                    {
                        currentControl          = control;
                        currentControlText      = tuple.text;
                        currentControlStartTime = EngineApp.GetSystemTime();
                        currentCursorPosition   = Control.MousePosition;
                    }
                }
            }

            //show form
            if (currentControl != null && currentControlForm == null)
            {
                //reset counter when mouse moved
                if (currentCursorPosition != Control.MousePosition)
                {
                    currentCursorPosition   = Control.MousePosition;
                    currentControlStartTime = EngineApp.GetSystemTime();
                }

                //show form
                if (EngineApp.GetSystemTime() > currentControlStartTime + initialDelay)
                {
                    currentControlForm = new EngineToolTipForm(currentControlText);
                    currentControlForm.StartPosition = FormStartPosition.Manual;
                    var mouse = Control.MousePosition;
                    currentControlForm.Location = new Point(mouse.X, mouse.Y + (int)(16.0f * EditorAPI.DPIScale));
                    currentControlForm.Show();
                }
            }
        }