private void View_GameFileEnter(object sender, GameFileEventArgs e) { if (m_gameFile != e.GameFile) { m_toolTip.Hide(m_form); m_gameFile = e.GameFile; m_toolTipTimer.Interval = TimerDelay; m_toolTipTimer.Start(); m_state = ToolTipState.Waiting; } }
private void ShowToolTip() { if (m_gameFile == null) { return; } ToolTipHandler toolTipHandler = new ToolTipHandler(); m_showPoint = GetMouseLocation(); m_toolTip.Show(toolTipHandler.GetToolTipText(m_form.Font, m_gameFile), m_form, m_showPoint.X, m_showPoint.Y, 32767); m_state = ToolTipState.Showing; }
private void ResetToolTipAndClear() { if (m_form.InvokeRequired) { m_form.Invoke(new Action(ResetToolTipAndClear)); } else { m_toolTip.Hide(m_form); m_state = ToolTipState.BeforeShow; m_gameFile = null; m_showPoint = new Point(); } }
//------------------------------------------------------------------------------- // private void Timer_Tick(object sender, EventArgs e) { try { lock (_lockTimer) { if (_timer != null) { _timer.Stop(); switch (_currentState) { case ToolTipState.DisplayWait: _currentState = ToolTipState.Displaying; Display(); if (_dispDuration > 0) { _timer.Interval = _dispDuration; _timer.Start(); } break; case ToolTipState.Displaying: _currentState = ToolTipState.FinDisplay; Hide(); break; } } } } catch (InvalidOperationException) { } }
//------------------------------------------------------------------------------- // private void DispControl_Enter(object sender, EventArgs e) { lock (_lockTimer) { if (!_active) { return; } if (_timer != null) { _timer.Stop(); } else { _timer = new Timer(); _timer.Tick += Timer_Tick; if (_initDelay > 0) { _timer.Interval = _initDelay; } } if (_initDelay <= 0) { _currentState = ToolTipState.Displaying; Display(); if (_dispDuration > 0) { _timer.Interval = _dispDuration; _timer.Start(); } } else { _currentState = ToolTipState.DisplayWait; _timer.Interval = _initDelay; _timer.Start(); } } }
//------------------------------------------------------------------------------- /// <summary> /// 隠蔽処理 /// </summary> public void Hide() { lock (_lockTimer) { if (_timer != null) { _timer.Stop(); _currentState = ToolTipState.EnterWait; if (_disp != null) { _disp.Close(); _disp = null; OnHideToolTip(); } } } }