问题
What wrong with my code ??
Why it not go to true statement ?
回答1:
Your if statement has three conditions - you're only showing two of them in the debugger.
I suspect that explains why you're seeing something odd - but I don't think your code is appropriate to start with. For one thing, you're testing the same condition twice, which is pointless (did you mean one of them to be lockScreen
rather than loginScreen
?) - but more importantly, if one of those InvokeRequired
properties returns false, you won't be using BeginInvoke
for any of the forms... even if InvokeRequired
returned true for that form.
I suggest you split this up into three separate blocks, each of which checks and acts on a single form.
回答2:
the third statement in the IF is a different boolean :)
来源:https://stackoverflow.com/questions/8945829/what-happen-with-my-invokedrequired