Control.CheckForIllegalCrossThreadCalls Control.CheckForIllegalCrossThreadCalls Control.CheckForIllegalCrossThreadCalls Control.CheckForIllegalCrossThreadCalls Property

定义

获取或设置一个值,该值指示是否捕获对错误线程的调用,这些调用在调试应用程序时访问控件的 Handle 属性。Gets or sets a value indicating whether to catch calls on the wrong thread that access a control's Handle property when an application is being debugged.

public:
 static property bool CheckForIllegalCrossThreadCalls { bool get(); void set(bool value); };
[System.ComponentModel.Browsable(false)]
public static bool CheckForIllegalCrossThreadCalls { get; set; }
member this.CheckForIllegalCrossThreadCalls : bool with get, set
Public Shared Property CheckForIllegalCrossThreadCalls As Boolean

属性值

如果捕获了对错误线程的调用,则为 true;否则为 falsetrue if calls on the wrong thread are caught; otherwise, false.

注解

当创建控件的线程以外的线程尝试访问该控件的方法或属性之一时,它通常会导致不可预知的结果。When a thread other than the creating thread of a control tries to access one of that control's methods or properties, it often leads to unpredictable results. 通常,无效的线程活动是对错误线程访问控件的调用Handle属性。A common invalid thread activity is a call on the wrong thread that accesses the control's Handle property. 设置CheckForIllegalCrossThreadCallstrue来查找和调试时更轻松地诊断此线程活动。Set CheckForIllegalCrossThreadCalls to true to find and diagnose this thread activity more easily while debugging.

适用于