What happen with my InvokedRequired?

2019-09-08 06:17发布

What wrong with my code ??

Why it not go to true statement ?

enter image description here

2条回答
倾城 Initia
2楼-- · 2019-09-08 06:54

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.

查看更多
淡お忘
3楼-- · 2019-09-08 07:17

the third statement in the IF is a different boolean :)

查看更多
登录 后发表回答