问题
I have a problem on one of my user’s PC’s where she cannot click on an image (well, she can click on it, but nothing happens). The image has the following XAML:
<Image Source="./Images/flag.jpg"
Name="image1"
Stretch="Uniform"
Height="40"
HorizontalAlignment="Right"
VerticalAlignment="Top"
ImageFailed="image1_ImageFailed"
Mouse.MouseDown="RotateImage"
Margin="0,0,0,0"
Cursor="Hand"/>
And the MouseDown event is handled by:
private void RotateImage(object sender, MouseEventArgs e)
{
//Some Code…
}
Every other user (there are 50+ of them) can click on the image and properly execute the code behind the event. Also, when I log into her PC (under my username), I am able to click the image and have the code behind execute properly. She is running XP, and this is .Net 3.5 app.
Also, when her mouse hovers over the image, the cursor changes from an arrow to a hand.
I have tried the following to alleviate this issue:
Start->Settings->Control Panel->System->Advanced->Performance->Settings: Under this I have tried all the different radio buttons, and a variety of combinations of the checkboxes. Nothing worked.
I have tried changing it from a dual display to a single display. No luck.
I have tried various resolution settings, but they didn’t change the outcome
There appears to be a custom setting for her that is preventing the routing of this event to the code, but I cannot find it. Any suggestions would be very much appreciated.
Thanks!
回答1:
Okay, after doing some of tests that JustABill suggested, it looks like I was mistaken. The application was responding to the mousedown event. However, the code behind the button was to respond to the name of the image file applied to the image control (and change image files in certain circumstances). The problem was that certain users’ PC’s were not able to recognize the name of the initial image file (the one assigned as default by the programmer), while others’ were. Also, I watched one user’s PC who had no trouble with the functionality at first. But upon running some additional tests a few hours later, it quit working (without having installed any updates). It’s a strange and inconsistent problem, but I was able to get around it by implementing some default functionality that reassigned a new image file to the image control if it doesn’t recognize the name of the image file presently applied. With that, everything started working properly.
Thanks to Wallstreet Programmer and JustABill for prodding me to try some new things!
John
来源:https://stackoverflow.com/questions/2858539/image-mousedown-event-not-firing