namg_engr
namg_engr

Reputation: 359

mouse cursor doesn't change on MouseLeave event

I have a couple of event handlers attached to a label: one is MouseEnter and the other is MouseLeave. The MouseEnter works fine and changes the mouse cursor to an IBeam as the mouse enters the label boundary, however, the mouse cursor doesn't back to an arrow and remains as an IBeam as the mouse exists the label boundary. I can't seem to figure out what is wrong.

    void lbRefLevel_MouseLeave(object sender, MouseEventArgs e)
    {
        Label lbRefLevel = (Label)sender;
        Mouse.OverrideCursor = Cursors.Arrow;
        Mouse.Capture(lbRefLevel);
    }

    void lbRefLevel_MouseEnter(object sender, MouseEventArgs e)
    {
        Label lbRefLevel = (Label)sender;
        Mouse.OverrideCursor = Cursors.IBeam;
        Mouse.Capture(lbRefLevel);
    } 

Upvotes: 0

Views: 212

Answers (1)

AllanC
AllanC

Reputation: 813

Set Mouse.OverrideCursor = null; in your mouse leave event, this will reset the override you done on your mouse enter.

Overriding again is not going to help.

Upvotes: 1

Related Questions