Change cursor over pictureBox

I tried to embed the image button in the winforms application as I can ... it is easy to use the asp.net problem it seems (I suspect) that when the mouse is over the image inside the image window it does not respond or does not raise the mouseEnter event

it looks like if I had a snapshot that is smaller than the size of the PictureBox, it will take the reason for the event to fire, but compared to the image in the pictureBox, won't it?

the trick was to set the pictureBox to sizeMode = zoom. then do 2 things when the mouse is over the "imageButton": resize the PictureBox a bit more + change the cursor on the hand

so i will get some kind of hint over the effect as i could with asp.net

Has anyone had this problem? I tried mouseHover first, then I thought that the input would be better since it only asks the mouse to pass the borders of the picture window ... both inputs and hover events did not help me ...

Edit:

event triggers a trigger, I see that if I initially set sizemode in CenterImage and inside the event I ask sizemode = to increase, so the dose of the effect arises .. but the cursor .current = Cursors.Hand will not change.

+4
source share
3 answers

This should work

private void pictureBox1_MouseEnter(object sender, EventArgs e) { pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; pictureBox1.Cursor = Cursors.Hand; } private void pictureBox1_MouseLeave(object sender, EventArgs e) { pictureBox1.SizeMode = PictureBoxSizeMode.Zoom; pictureBox1.Cursor = Cursors.Default; } 
+10
source

it looks like I should have learned better how to use the Cursors class.

 cursor=Cursors.hand; 

but not

 cursor.current=Cursors.hand; 

what was embarrassing ..

+1
source

add only the MouseMove event to the pictureBox and set the cursor for this

 private void pictureBox1_MouseMove(object sender, MouseEventArgs e) { pictureBox1.Cursor = Cursors.Hand; } 
+1
source

All Articles