Clipboard.Clear Clipboard.Clear Clipboard.Clear Clipboard.Clear Method

定義

從剪貼簿中移除所有資料。Removes all data from the Clipboard.

public:
 static void Clear();
public static void Clear ();
static member Clear : unit -> unit
Public Shared Sub Clear ()

例外狀況

無法清除剪貼簿。The Clipboard could not be cleared. 這通常在剪貼簿由另一個處理序使用時發生。This typically occurs when the Clipboard is being used by another process.

目前執行緒 (Thread) 不是在單一執行緒 Apartment (STA) 模式。The current thread is not in single-threaded apartment (STA) mode. STAThreadAttribute 加入至應用程式的 Main 方法。Add the STAThreadAttribute to your application's Main method.

範例

下列範例會示範這個成員。The following example demonstrates this member.

Clipboard.Clear();
Clipboard.Clear()

備註

因為多個處理序都共用剪貼簿,則呼叫這個方法可能會對這些處理序的影響。Because the Clipboard is shared by multiple processes, calling this method may have an impact on those processes.

注意

Clipboard類別只能設定為單一執行緒 apartment (STA) 模式的執行緒中。The Clipboard class can only be used in threads set to single thread apartment (STA) mode. 若要使用這個類別,請確認您Main方法會標示STAThreadAttribute屬性。To use this class, ensure that your Main method is marked with the STAThreadAttribute attribute.

安全性

UIPermission
清除系統剪貼簿。for clearing the system Clipboard. 相關聯的列舉型別: OwnClipboardAssociated enumeration: OwnClipboard

適用於