Click here to Skip to main content
15,913,758 members
Home / Discussions / C#
   

C#

 
GeneralRe: Create click event for Class Pin
Steven Solberg29-May-10 7:12
Steven Solberg29-May-10 7:12 
GeneralRe: Create click event for Class Pin
Luc Pattyn29-May-10 7:52
sitebuilderLuc Pattyn29-May-10 7:52 
GeneralRe: Create click event for Class Pin
Steven Solberg29-May-10 8:16
Steven Solberg29-May-10 8:16 
GeneralRe: Create click event for Class Pin
Luc Pattyn29-May-10 8:47
sitebuilderLuc Pattyn29-May-10 8:47 
GeneralRe: Create click event for Class Pin
Steven Solberg29-May-10 9:02
Steven Solberg29-May-10 9:02 
GeneralRe: Create click event for Class Pin
Luc Pattyn29-May-10 9:14
sitebuilderLuc Pattyn29-May-10 9:14 
GeneralRe: Create click event for Class Pin
Steven Solberg29-May-10 9:25
Steven Solberg29-May-10 9:25 
GeneralRe: Create click event for Class Pin
Luc Pattyn29-May-10 9:46
sitebuilderLuc Pattyn29-May-10 9:46 
OK. Now we are getting tangible information. I think one of your mouse handlers is taking too long for comfort. You should not have anything blocking in there, such as Thread.Sleep; Thread.Join; and many more.

This is what I recommend to improve observability:
- add logging to all mouse event handlers; say one log on entry, one log on exit.
- make a single log method to do the actual logging, it should take a single string parameter identifying which method is calling it
- make sure the log will include a timestamp, up to the millisecond (*);
- log to one or several outputs, including a file so you have a chronological log.

Here is an example that I use often; it is based on a free running stopwatch (DateTime.Now isn't accurate enough as I explained here[^]):

public static void log(string s) {
    long msec=myStopWatch.ElapsedMilliseconds;
    int TID=Thread.GetCurrentThread().ManagedThreadId;
    s=msec.ToString("D8")+"  ["+TID.ToString("X2")+"]  "+s;
    Console.WriteLine(s);
    File.AppendText(logFilePath, s+Environment.NewLine); // file is always closed!
}

public void MouseDown(...) {
    log("MouseDown begin");
    ...
    log("MouseDown end");
}


If you don't touch GUI Controls in the log method, you can call it also from any thread you like to track. If it needs GUI access, you need Invoke stuff as explained here[^], but I guess you know all that.

Now run and watch the log it generates. Look for handlers taking more than 20 milliseconds; and for strange sequences of events.

Smile | :)
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]

I only read formatted code with indentation, so please use PRE tags for code snippets.

I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).

GeneralRe: Create click event for Class Pin
Steven Solberg29-May-10 9:58
Steven Solberg29-May-10 9:58 
GeneralRe: Create click event for Class Pin
Luc Pattyn29-May-10 10:04
sitebuilderLuc Pattyn29-May-10 10:04 
GeneralRe: Create click event for Class Pin
Steven Solberg30-May-10 1:46
Steven Solberg30-May-10 1:46 
GeneralRe: Create click event for Class Pin
Luc Pattyn30-May-10 1:59
sitebuilderLuc Pattyn30-May-10 1:59 
GeneralRe: Create click event for Class Pin
Steven Solberg30-May-10 2:56
Steven Solberg30-May-10 2:56 
GeneralRe: Create click event for Class Pin
Steven Solberg30-May-10 3:36
Steven Solberg30-May-10 3:36 
Questionhow can i do this Controls c# Pin
neverpleat28-May-10 20:29
neverpleat28-May-10 20:29 
AnswerRe: how can i do this Controls c# Pin
Ankur\m/28-May-10 21:29
professionalAnkur\m/28-May-10 21:29 
GeneralRe: how can i do this Controls c# Pin
neverpleat29-May-10 0:32
neverpleat29-May-10 0:32 
AnswerRe: how can i do this Controls c# Pin
OriginalGriff28-May-10 22:01
mveOriginalGriff28-May-10 22:01 
GeneralRe: how can i do this Controls c# Pin
neverpleat29-May-10 0:29
neverpleat29-May-10 0:29 
GeneralRe: how can i do this Controls c# Pin
Ankur\m/29-May-10 0:41
professionalAnkur\m/29-May-10 0:41 
GeneralRe: how can i do this Controls c# Pin
OriginalGriff29-May-10 0:43
mveOriginalGriff29-May-10 0:43 
Questiondelegate invocation Pin
xilefxilef28-May-10 20:06
xilefxilef28-May-10 20:06 
AnswerRe: delegate invocation Pin
Moreno Airoldi28-May-10 22:36
Moreno Airoldi28-May-10 22:36 
AnswerRe: delegate invocation Pin
PIEBALDconsult29-May-10 3:20
mvePIEBALDconsult29-May-10 3:20 
GeneralRe: delegate invocation Pin
xilefxilef29-May-10 18:34
xilefxilef29-May-10 18:34 

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.