Yes - I had already attempted what you suggested without any luck.
Basically - what I need to do is the following (shown by using System.Windows.Forms.Form instead)
private void Form1_Load(object sender, EventArgs e)
{
ToolForm f = new ToolForm();
f.MouseEnter += new EventHandler(f_MouseEnter);
f.MouseLeave += new EventHandler(f_MouseLeave);
f.Activated += new EventHandler(f_Activated);
f.Deactivate += new EventHandler(f_Deactivate);
f.TopMost = true;
f.Show();
}
bool _activated = false;
void f_Deactivate(object sender, EventArgs e)
{
((Form)sender).Opacity = 0.8F;
_activated = false;
}
void f_Activated(object sender, EventArgs e)
{
((Form)sender).Opacity = 1.0F;
_activated = true;
}
void f_MouseLeave(object sender, EventArgs e)
{
if (_activated) return; // if activated, keep the opacity until de-activation
((Form)sender).Opacity = 0.8F;
}
void f_MouseEnter(object sender, EventArgs e)
{
((Form)sender).Opacity = 1.0F;
}
...where, ToolForm is just a standard Form with control etc on it.
I tried the following code as you suggested...
toolWindow.MouseEnter+=new EventHandler(toolWindow_MouseEnter);
but the event wasn't hooked.
I'm wondering if some code inside the ToolWindow creates a Form derived object, and that the Form derived object overrides OnMouseEnter and doesn't pass control back to the base implementation allowing the event to fire.
I'll check with Reflector and in the debugger tomorrow...