Langue

Clipboard.GetFileDropList Méthode

Définition

Récupère une collection de noms de fichiers à partir du Presse-papiers.

public:
 static System::Collections::Specialized::StringCollection ^ GetFileDropList();
public static System.Collections.Specialized.StringCollection GetFileDropList();
static member GetFileDropList : unit -> System.Collections.Specialized.StringCollection
Public Shared Function GetFileDropList () As StringCollection

Retours

Un StringCollection nom de fichier contenant ou null si le Presse-papiers ne contient aucune donnée au FileDrop format ou peut être converti dans ce format.

Exceptions

Le Presse-papiers n’a pas pu être effacé. Cela se produit généralement lorsque le Presse-papiers est utilisé par un autre processus.

Le thread actuel n’est pas en mode STA (Single-Threaded Apartment). Ajoutez la STAThreadAttribute méthode de Main votre application.

Exemples

L’exemple suivant illustre ce membre.

// Demonstrates SetFileDropList, ContainsFileDroList, and GetFileDropList
public System.Collections.Specialized.StringCollection
    SwapClipboardFileDropList(
    System.Collections.Specialized.StringCollection replacementList)
{
    System.Collections.Specialized.StringCollection returnList = null;
    if (Clipboard.ContainsFileDropList())
    {
        returnList = Clipboard.GetFileDropList();
        Clipboard.SetFileDropList(replacementList);
    }
    return returnList;
}
' Demonstrates SetFileDropList, ContainsFileDroList, and GetFileDropList
Public Function SwapClipboardFileDropList(ByVal replacementList _
    As System.Collections.Specialized.StringCollection) _
    As System.Collections.Specialized.StringCollection

    Dim returnList As System.Collections.Specialized.StringCollection _
        = Nothing

    If Clipboard.ContainsFileDropList() Then

        returnList = Clipboard.GetFileDropList()
        Clipboard.SetFileDropList(replacementList)
    End If

    Return returnList

End Function

Remarques

Une liste déroulante de fichiers est une collection de chaînes contenant des informations de chemin d’accès pour les fichiers.

Une liste déroulante de fichiers est stockée dans le Presse-papiers sous forme de String tableau. Cette méthode convertit ce tableau en un StringCollection et retourne la collection.

Utilisez la ContainsFileDropList méthode pour déterminer si le Presse-papiers contient une liste déroulante de fichiers avant de la récupérer avec cette méthode.

Utilisez la SetFileDropList méthode pour ajouter une liste déroulante de fichiers au Presse-papiers.

Note

La Clipboard classe ne peut être utilisée que dans les threads définis en mode STA (Single Thread Apartment). Pour utiliser cette classe, vérifiez que votre Main méthode est marquée avec l’attribut STAThreadAttribute .

S’applique à

Voir aussi