Click here to Skip to main content
16,015,658 members
Home / Discussions / C#
   

C#

 
GeneralRe: Reports... Ahhhh Pin
Alex Korchemniy26-Oct-04 12:00
Alex Korchemniy26-Oct-04 12:00 
GeneralRe: Reports... Ahhhh Pin
Nick Parker26-Oct-04 13:33
protectorNick Parker26-Oct-04 13:33 
GeneralRe: Reports... Ahhhh Pin
Michael P Butler27-Oct-04 2:46
Michael P Butler27-Oct-04 2:46 
GeneralMsn Messenger Programming Pin
Adnan Siddiqi26-Oct-04 7:20
Adnan Siddiqi26-Oct-04 7:20 
GeneralRe: Msn Messenger Programming Pin
Nick Parker26-Oct-04 7:39
protectorNick Parker26-Oct-04 7:39 
GeneralRe: Msn Messenger Programming Pin
Adnan Siddiqi26-Oct-04 8:46
Adnan Siddiqi26-Oct-04 8:46 
Generalmouse hover / mouse leave Pin
ee9903526-Oct-04 6:25
ee9903526-Oct-04 6:25 
GeneralRe: mouse hover / mouse leave Pin
Heath Stewart26-Oct-04 6:54
protectorHeath Stewart26-Oct-04 6:54 
The MouseHover event won't be fired when your mouse leaves the client area, but that doesn't mean the code inside your MouseHover event won't continue to run. It will run until it completes. If you want to stop it, you should consider using a state variable (like a bool field called stop or something) that your MouseLeave event handler sets (i.e., set to true) and your MouseHover event checks, conditionally exits its loop, and resets (i.e., set to false).

The real problem I see with your code, however, is what you're doing within MouseHover. If you read the documentation (always a good thing), it states that the MouseHover event is fired continuously (several times a second) - even when you're mouse is not moving. You should not be performing exhaustive routines like you are now. Not only are you hogging up CPU cycles but you're most likely exhausting memory (especially if you're not disposing objects that require it, like the original Image that was assigned to the PictureBox.Image property).

You should consider using a timer that you enable once (don't enable it again if it's already enabled and use state variables like I mentioned in the first paragraph) and lets it run - don't execute your code continuously if you don't need to, and always dispose objects that implement IDisposable (like the Image and Bitmap classes, among many others) if you need to free memory immediately (for classes that follow the disposable pattern, they will eventually be released but only when the GC decides to clean-up that generation).

This posting is provided "AS IS" with no warranties, and confers no rights.

Software Design Engineer
Developer Division Sustained Engineering
Microsoft

[My Articles] [My Blog]
GeneralRe: mouse hover / mouse leave Pin
ee9903526-Oct-04 7:10
ee9903526-Oct-04 7:10 
GeneralRe: mouse hover / mouse leave Pin
Heath Stewart26-Oct-04 10:19
protectorHeath Stewart26-Oct-04 10:19 
GeneralRe: mouse hover / mouse leave Pin
ee9903527-Oct-04 7:45
ee9903527-Oct-04 7:45 
GeneralRe: mouse hover / mouse leave Pin
Heath Stewart27-Oct-04 14:08
protectorHeath Stewart27-Oct-04 14:08 
QuestionRAS API Wrapped in C#??? Pin
mrr26-Oct-04 5:57
mrr26-Oct-04 5:57 
AnswerRe: RAS API Wrapped in C#??? Pin
Heath Stewart26-Oct-04 7:03
protectorHeath Stewart26-Oct-04 7:03 
AnswerRe: RAS API Wrapped in C#??? Pin
Alex Korchemniy26-Oct-04 11:57
Alex Korchemniy26-Oct-04 11:57 
GeneralXmlElement.SetAttribute not working as expected Pin
Colin Angus Mackay26-Oct-04 5:10
Colin Angus Mackay26-Oct-04 5:10 
GeneralRe: XmlElement.SetAttribute not working as expected Pin
Heath Stewart26-Oct-04 7:00
protectorHeath Stewart26-Oct-04 7:00 
QuestionC++ header to .NET? Pin
hagay_ar26-Oct-04 4:44
hagay_ar26-Oct-04 4:44 
AnswerRe: C++ header to .NET? Pin
Heath Stewart26-Oct-04 6:23
protectorHeath Stewart26-Oct-04 6:23 
GeneralC# with some code in MFC Pin
ee9903526-Oct-04 4:40
ee9903526-Oct-04 4:40 
GeneralRe: C# with some code in MFC Pin
Judah Gabriel Himango26-Oct-04 5:20
sponsorJudah Gabriel Himango26-Oct-04 5:20 
GeneralRe: C# with some code in MFC Pin
Heath Stewart26-Oct-04 6:30
protectorHeath Stewart26-Oct-04 6:30 
GeneralSleep function in C# Pin
Ariadne26-Oct-04 4:16
Ariadne26-Oct-04 4:16 
GeneralRe: Sleep function in C# Pin
Judah Gabriel Himango26-Oct-04 4:24
sponsorJudah Gabriel Himango26-Oct-04 4:24 
GeneralRe: Sleep function in C# Pin
Gary Thom26-Oct-04 4:29
Gary Thom26-Oct-04 4:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.