Esempio n. 1
0
        private void Notifybar_timer_Tick(object sender, EventArgs e)
        {
            POINT pt = new POINT();

            //获取鼠标的位置
            GetCursorPos(out pt);

            //获取托盘图标的位置
            RG rg = GetIconRect(_trayIcon);

            if (pt.x > rg.Left && pt.x < (rg.Left + rg.Width) && pt.y > rg.Top && pt.y < (rg.Top + rg.Height))
            {
                //鼠标指针还在托盘图标中,不需要处理
            }
            else
            {
                _trayWinTimer.Stop();

                //判断指针是否移入了弹框的区域
                if (_trayWin != null && _isMouseEnterWindow == false)
                {
                    _trayWin.Hide();
                }
            }
        }
Esempio n. 2
0
        private void _trayWin_MouseLeave(object sender, System.Windows.Input.MouseEventArgs e)
        {
            if (_isMouseEnterWindow)
            {
                _trayWin?.Hide();
            }

            _isMouseEnterWindow = false;
        }