@@ -16,24 +16,26 @@ class ToolTipForm : Form
1616 FormattedText _text ;
1717 System . ComponentModel . IContainer components ;
1818 Win32Window _owner ;
19+ // Help Link
20+ Rectangle _linkClientRect ;
21+ bool _linkActive ;
22+ string _linkAddress ;
23+ // Mouse Capture information for moving
24+ bool _captured = false ;
25+ Point _mouseDownScreenLocation ;
26+ Point _mouseDownFormLocation ;
1927 // We keep track of this, else Visibility seems to confuse things...
2028 int _left ;
2129 int _top ;
30+ int _showLeft ;
31+ int _showTop ;
2232 // Various graphics object cached
2333 Brush _textBrush ;
2434 Brush _linkBrush ;
2535 Pen _borderPen ;
2636 Pen _borderLightPen ;
2737 Dictionary < FontStyle , Font > _fonts ;
2838 ToolTip tipDna ;
29- // Help Link
30- Rectangle _linkClientRect ;
31- bool _linkActive ;
32- string _linkAddress ;
33- // Mouse Capture information for moving
34- bool _captured = false ;
35- Point _mouseDownScreenLocation ;
36- Point _mouseDownFormLocation ;
3739
3840 public ToolTipForm ( IntPtr hwndOwner )
3941 {
@@ -108,27 +110,36 @@ void ShowToolTip()
108110 public void ShowToolTip ( FormattedText text , int left , int top )
109111 {
110112 _text = text ;
111- _left = left ;
112- _top = top ;
113+ if ( left != _showLeft || top != _showTop )
114+ {
115+ // Update the start position and the current position
116+ _left = left ;
117+ _top = top ;
118+ _showLeft = _left ;
119+ _showTop = _top ;
120+ }
113121 if ( ! Visible )
114122 {
115- Debug . Print ( $ "Showing ToolTipForm: { _text . ToString ( ) } ") ;
123+ Debug . Print ( $ "ShowToolTip - Showing ToolTipForm: { _text . ToString ( ) } ") ;
116124 // Make sure we're in the right position before we're first shown
117125 SetBounds ( _left , _top , 0 , 0 ) ;
118126 ShowToolTip ( ) ;
119127 }
120128 else
121129 {
122- Debug . Print ( $ "Invalidating ToolTipForm: { _text . ToString ( ) } ") ;
130+ Debug . Print ( $ "ShowToolTip - Invalidating ToolTipForm: { _text . ToString ( ) } ") ;
123131 Invalidate ( ) ;
124132 }
125133 }
126134
127135
128136 public void MoveToolTip ( int left , int top )
129137 {
138+ // We might consider checking the new position against earlier mouse movements
130139 _left = left ;
131140 _top = top ;
141+ _showLeft = _left ;
142+ _showTop = _top ;
132143 Invalidate ( ) ;
133144 }
134145
0 commit comments