In dot net 2003 on Xp when you go to the file menu and select Open file a
dialog box opens up
on the left hand side there are items such as
history
My Projects
Desktop
Favorites
My Network places
when the mouse hovers over any of the above items, the item changes state
(image) it has raised look with a new image and the background is light
blue. and when you click the item it has suck state with a new image etc.
I am trying to mimic that exact look for my configuration. I am deriving it
from Usercontrol. on top of the user contol i have a panel, in the panel i
have a an image button and a lable. Mostly it works but the problems is
that it sometime works fine but sometimes it just never gets mouse out call
at all . Anyone have a better idea on how i can achieve this.
i use the following code
public void MouseOverHandler()
{
Rectangle r = new Rectangle(panel1.Location, panel1.Size);
Point p = this.PointToClient(Cursor.Position);
if(r.Contains(p) && !isFocused)
{
System.Diagnostics.Debug.WriteLine("mouse over executed");
panel1.BackColor = Color.FromKnownColor(KnownColor.InactiveCaption);
panel1.BorderStyle = BorderStyle.FixedSingle;
NavName.BackColor = Color.FromKnownColor(KnownColor.InactiveCaption);
NavName.ForeColor = Color.Black;
picNormalImage.Visible = false;
picHoverImage.Visible = true;
isFocused = true;
}
}
public void MouseOutHandler()
{
Rectangle r = new Rectangle(panel1.Location, panel1.Size);
Point p = this.PointToClient(Cursor.Position);
if(r.Contains(p) && !IsClicked )
{
return;
}
System.Diagnostics.Debug.WriteLine("mouse not in Rect");
isFocused = false;
panel1.BackColor = Color.FromKnownColor(KnownColor.Highlight);
panel1.BorderStyle = BorderStyle.None;
NavName.BackColor = Color.FromKnownColor(KnownColor.Highlight);
NavName.ForeColor = Color.Cornsilk;
picNormalImage.Visible = true;
picHoverImage.Visible = false;
}