0

尝试包含基于以下代码的 hoverIntent:

private void ViewerTab_MouseLeave(object sender, MouseEventArgs e)
            {
                _mouseOverTabPanel = false;

                ChangeCurrentPanelPosition(TabPanelPosition.Bottom);
            }

            private void ViewerTab_MouseEnter(object sender, MouseEventArgs e)
            {
                _mouseOverTabPanel = true;
            }

理想情况下,ChangeCurrentPanelPosition 应该只在 mouseleave 约 1 秒后触发,如果 mouseEnter 再次出现,计时器将清除。

4

1 回答 1

0

这对我有用:

public DispatcherTimer myDispatcherTimer = new DispatcherTimer();

private void ViewerTab_MouseLeave(object sender, MouseEventArgs e)
{
    myDispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 1000);
    myDispatcherTimer.Tick += new EventHandler(functiontocall);
    myDispatcherTimer.Start();
}

public void functiontocall(object o, EventArgs sender)
{
    // do something here

    myDispatcherTimer.Stop();
}

private void ViewerTab_MouseEnter(object sender, MouseEventArgs e)
{
    myDispatcherTimer.Stop();
}
于 2010-09-16T04:14:31.713 回答