By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 1,142 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

MouseHover delay with PictureBox

P: 1
I have recently designed a Winform Image drag & drop utility. The approach I took was to have a Panel control serve as a destination for multiple file drop. Once the user dragged & dropped the desired files I do a check to ensure that I only process the image files (".jpg", ".png", etc), while any other files are ignored by the program. For every image file being dropped I programmatically create a PictureBox control, do proper resizing of an image in question, load it into the PictureBox, and finally position the PictureBox with appropriate offset within the Panel to ensure it is nicely aligned with the rest of the PictureBox controls.

Now onto my question.... for each PictureBox control I implement a MouseHover event by means of which I am changing the color and thickness of the border for the PictureBox pointed by the mouse. I don't know why but I can't help but notice that there's a considerable delay between the time the mouse is over a given PictureBox control and the time I actually see the new border appear around it.

Has anyone here gone through similar experiences and found a workaround to eliminate this delay? I know the PictureBox is redrawn every time I mouse over it and I believe it's using GDI+ graphics object in the OnPaint() method to redraw the changes, which may account for the slowness. But is there a way of implementing the border change functionality for a PictureBox control to avoid this delay ?
Jan 28 '09 #1
Share this Question
Share on Google+
1 Reply


Plater
Expert 5K+
P: 7,872
MouseHover by design, doesn't fire until the mouse has been stationary for some time.(Quote microsoft)
If you want immediate results look for MouseEnter and MouseLeave events.
(If need be you can also check out MouseMove, but the other two should be fine)
Jan 29 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.