EventLog.SynchronizingObject EventLog.SynchronizingObject EventLog.SynchronizingObject EventLog.SynchronizingObject Property

定義

取得或設定物件,其用於封送處理 (Marshal) 因為 EventLog 項目寫入事件而發出的事件處理常式呼叫。Gets or sets the object used to marshal the event handler calls issued as a result of an EventLog entry written event.

public:
 property System::ComponentModel::ISynchronizeInvoke ^ SynchronizingObject { System::ComponentModel::ISynchronizeInvoke ^ get(); void set(System::ComponentModel::ISynchronizeInvoke ^ value); };
[System.ComponentModel.Browsable(false)]
public System.ComponentModel.ISynchronizeInvoke SynchronizingObject { get; set; }
member this.SynchronizingObject : System.ComponentModel.ISynchronizeInvoke with get, set
Public Property SynchronizingObject As ISynchronizeInvoke

屬性值

ISynchronizeInvoke,用來封送處理因為事件記錄檔上的 EntryWritten 事件而發出的事件處理常式呼叫。The ISynchronizeInvoke used to marshal event-handler calls issued as a result of an EntryWritten event on the event log.

備註

SynchronizingObjectnull時, 處理EntryWritten事件的方法會在系統執行緒集區的執行緒上呼叫。When SynchronizingObject is null, methods handling the EntryWritten event are called on a thread from the system thread pool. 如需系統執行緒集區的詳細資訊ThreadPool, 請參閱。For more information on system thread pools, see ThreadPool.

當 visual Windows Forms 元件 (例如按鈕) 處理此事件時,透過系統執行緒集區存取元件可能無法正常執行,或可能會導致例外狀況。EntryWrittenWhen the EntryWritten event is handled by a visual Windows Forms component, such as a button, accessing the component through the system thread pool might not work, or might result in an exception. 若要避免這個SynchronizingObject問題, 請將設定為 Windows Forms 元件, 這會EntryWritten導致處理該事件的方法在建立該元件的相同執行緒上呼叫。Avoid this by setting SynchronizingObject to a Windows Forms component, which causes the methods handling the EntryWritten event to be called on the same thread on which the component was created.

如果在 Windows Forms 設計工具Visual Studio 2005Visual Studio 2005內使用, SynchronizingObject則會自動設定為包含的EventLog控制項。 EventLogIf the EventLog is used inside Visual Studio 2005Visual Studio 2005 in a Windows Forms designer, SynchronizingObject is automatically set to the control containing the EventLog. 例如, EventLog如果您將放在 form1 的設計工具上 (繼承自Form), 則SynchronizingObject的屬性EventLog會設定為 form1 的實例。For example, if you place an EventLog on a designer for Form1 (which inherits from Form) the SynchronizingObject property of EventLog is set to the instance of Form1.

安全性

EventLogPermission
用於寫入電腦上的事件記錄檔資訊。for writing the event log information on the computer. 相關聯的列舉:WriteAssociated enumeration: Write

適用於

另請參閱