Beispiel #1
0
        /// <summary>Hide the hint balloon</summary>
        private void HideHintInternal(int issue)
        {
            lock (m_lock)
            {
                // Only hide if the issue number is still valid
                if (issue != m_issue || !Visible)
                {
                    return;
                }

                // Test if the mouse is over the form, if so, wait another 2000
                var pt   = PointToClient(Cursor.Position);
                var rect = ClientRectangle.Inflated(-TipLength, -TipLength);
                if (rect.Contains(pt))
                {
                    Opacity = 1f;
                    Dispatcher_.BeginInvokeDelayed(() => HideHintInternal(issue), TimeSpan.FromMilliseconds(2000));
                    return;
                }

                // Do fading
                if (FadeDuration > 0)
                {
                    Opacity -= Math.Min(0.1, Opacity);
                    if (Opacity == 0)
                    {
                        Visible = false;
                    }
                    else
                    {
                        Dispatcher_.BeginInvokeDelayed(() => HideHintInternal(issue), TimeSpan.FromMilliseconds(FadeDuration / 10));
                    }
                    return;
                }

                // Done, hidden
                DetachFromOwner();
            }
        }