Note that there are some explanatory texts on larger screens.

plurals
  1. POC# - Changing button image event is not rising
    primarykey
    data
    text
    <p>I am making a simple program that changes the image of a button when the user interact with it. When the computer mouse gets inside the button the image highlights, when the mouse clicks it gets darker and when the mouse leaves the button, the image gets norma. To accomplish this behavior I am changing the button image between 3 images, BUT when I click the button and it displays a modal control, e.g. a MessageBox, when it goes back from the MessageBox, the image in the button is still the "mouse inside" image, but the mouse is out of the button already...so I think the button1_MouseLeave event is not rising, but I dont understand why and how to repair it...can you guys help me out on this one? The code I am using is simple:</p> <pre><code>using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace teste1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_MouseLeave(object sender, EventArgs e) { button1.Image = ((System.Drawing.Image)(Properties.Resources.Botao_Del_Normal)); } private void button1_MouseEnter(object sender, EventArgs e) { button1.Image = ((System.Drawing.Image)(Properties.Resources.Botao_Del_Claro)); } private void button1_Click(object sender, EventArgs e) { MessageBox.Show("Test"); } private void button1_MouseDown(object sender, MouseEventArgs e) { button1.Image = ((System.Drawing.Image)(Properties.Resources.Botao_Del_Clique)); } private void button1_MouseUp(object sender, MouseEventArgs e) { button1.Image = ((System.Drawing.Image)(Properties.Resources.Botao_Del_Claro)); } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload