• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 594
  • Last Modified:

Make a button bigger when the cursor hovering the button in WPF C#

How do you define to make a button bigger when the mouse hovering on top of a button?
0
xewoox
Asked:
xewoox
2 Solutions
 
CebikCommented:
In WindowsApplication project it looks like for example:

Size normal = new Size(50, 21);
Size big = new Size(55, 23);
 
private void button1_MouseLeave(object sender, EventArgs e)
{
    button1.Size = normal;
}
 
private void button1_MouseEnter(object sender, EventArgs e)
{
    button1.Size = big;
}

Open in new window

0
 
xewooxAuthor Commented:
The above code does not work under WPF C# , You need to do the following.
private void button1_MouseLeave(object sender, EventArgs e)
{
    Button button1 = (Button)  sender;
    button1.Height = 21; button1.width = 50;
}
 
private void button1_MouseEnter(object sender, EventArgs e)
{
    Button button1 = (Button)  sender;
    button1.Height = 23; button1.width = 51;
}
0
 
copyPasteGhostCommented:
So did you fix it?
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now