Skip to content

Commit d5d45be

Browse files
committed
Fix for #53 Double-clicking the tooltip makes it flicker
1 parent 0570fa8 commit d5d45be

File tree

1 file changed

+40
-40
lines changed

1 file changed

+40
-40
lines changed

Source/ExcelDna.IntelliSense/ToolTipForm.cs

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -65,46 +65,46 @@ public ToolTipForm(IntPtr hwndOwner)
6565
_borderLightPen = new Pen(Color.FromArgb(225, 225, 225));
6666
SetStyle(ControlStyles.UserMouse | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
6767
Debug.Print($"Created ToolTipForm with owner {hwndOwner}");
68-
}
69-
70-
protected override void WndProc(ref Message m)
71-
{
72-
const int WM_MOUSEACTIVATE = 0x21;
73-
const int WM_MOUSEMOVE = 0x0200;
74-
const int WM_LBUTTONDOWN = 0x0201;
75-
const int WM_LBUTTONUP = 0x0202;
76-
const int WM_LBUTTONDBLCLK = 0x203;
77-
const int WM_SETCURSOR = 0x20;
78-
const int MA_NOACTIVATE = 0x0003;
79-
80-
switch (m.Msg)
81-
{
82-
// Prevent activation by mouse interaction
83-
case WM_MOUSEACTIVATE:
84-
m.Result = (IntPtr)MA_NOACTIVATE;
85-
return;
86-
// We're never active, so we need to do our own mouse handling
87-
case WM_LBUTTONDOWN:
88-
MouseButtonDown(GetMouseLocation(m.LParam));
89-
return;
90-
case WM_MOUSEMOVE:
91-
MouseMoved(GetMouseLocation(m.LParam));
92-
return;
93-
case WM_LBUTTONUP:
94-
MouseButtonUp(GetMouseLocation(m.LParam));
95-
return;
96-
case WM_SETCURSOR:
97-
case WM_LBUTTONDBLCLK:
98-
// We need to handle this message to prevent flicker (possibly because we're not 'active').
99-
m.Result = new IntPtr(1); //Signify that we dealt with the message.
100-
return;
101-
default:
102-
base.WndProc(ref m);
103-
return;
104-
}
105-
}
106-
107-
void ShowToolTip()
68+
}
69+
70+
protected override void WndProc(ref Message m)
71+
{
72+
const int WM_MOUSEACTIVATE = 0x21;
73+
const int WM_MOUSEMOVE = 0x0200;
74+
const int WM_LBUTTONDOWN = 0x0201;
75+
const int WM_LBUTTONUP = 0x0202;
76+
const int WM_LBUTTONDBLCLK = 0x203;
77+
const int WM_SETCURSOR = 0x20;
78+
const int MA_NOACTIVATE = 0x0003;
79+
80+
switch (m.Msg)
81+
{
82+
// Prevent activation by mouse interaction
83+
case WM_MOUSEACTIVATE:
84+
m.Result = (IntPtr)MA_NOACTIVATE;
85+
return;
86+
// We're never active, so we need to do our own mouse handling
87+
case WM_LBUTTONDOWN:
88+
MouseButtonDown(GetMouseLocation(m.LParam));
89+
return;
90+
case WM_MOUSEMOVE:
91+
MouseMoved(GetMouseLocation(m.LParam));
92+
return;
93+
case WM_LBUTTONUP:
94+
MouseButtonUp(GetMouseLocation(m.LParam));
95+
return;
96+
case WM_SETCURSOR:
97+
case WM_LBUTTONDBLCLK:
98+
// We need to handle this message to prevent flicker (possibly because we're not 'active').
99+
m.Result = new IntPtr(1); //Signify that we dealt with the message.
100+
return;
101+
default:
102+
base.WndProc(ref m);
103+
return;
104+
}
105+
}
106+
107+
void ShowToolTip()
108108
{
109109
try
110110
{

0 commit comments

Comments
 (0)