DataFormats.Text Veld
Definitie
Belangrijk
Bepaalde informatie heeft betrekking op een voorlopige productversie die aanzienlijk kan worden gewijzigd voordat deze wordt uitgebracht. Microsoft biedt geen enkele expliciete of impliciete garanties met betrekking tot de informatie die hier wordt verstrekt.
Hiermee geeft u de standaard ANSI-tekstindeling. Dit static veld heeft het kenmerk Alleen-lezen.
public: static initonly System::String ^ Text;
public static readonly string Text;
staticval mutable Text : string
Public Shared ReadOnly Text As String
Waarde van veld
Voorbeelden
In het volgende codevoorbeeld ziet u het gebruik van dit lid.
try
{
String^ myString = "This is a String from the ClipBoard";
// Sets the data into the Clipboard.
Clipboard::SetDataObject( myString );
IDataObject^ myDataObject = Clipboard::GetDataObject();
// Checks whether the format of the data is 'UnicodeText' or not.
if ( myDataObject->GetDataPresent( DataFormats::UnicodeText ) )
{
Console::WriteLine( "Data in 'UnicodeText' format: " +
myDataObject->GetData( DataFormats::UnicodeText ) );
}
else
{
Console::WriteLine( "No String information was contained in the clipboard." );
}
// Checks whether the format of the data is 'Text' or not.
if ( myDataObject->GetDataPresent( DataFormats::Text ) )
{
String^ clipString = (String^)(myDataObject->GetData( DataFormats::StringFormat ));
Console::WriteLine( "Data in 'Text' format: {0}", clipString );
}
}
catch ( Exception^ e )
{
Console::WriteLine( e->Message );
}
try
{
String myString = "This is a String from the ClipBoard";
// Sets the data into the Clipboard.
Clipboard.SetDataObject(myString);
IDataObject myDataObject = Clipboard.GetDataObject();
// Checks whether the format of the data is 'UnicodeText' or not.
if(myDataObject.GetDataPresent(DataFormats.UnicodeText))
{
Console.WriteLine("Data in 'UnicodeText' format:"+myDataObject.GetData(DataFormats.UnicodeText));
}
else
{
Console.WriteLine("No String information was contained in the clipboard.");
}
// Checks whether the format of the data is 'Text' or not.
if(myDataObject.GetDataPresent(DataFormats.Text))
{
String clipString = (String)myDataObject.GetData(DataFormats.StringFormat);
Console.WriteLine("Data in 'Text' format:"+clipString);
}
}
catch(Exception e)
{
Console.WriteLine(e.Message);
}
Try
Dim myString As String = "This is a String from the ClipBoard"
' Sets the data into the Clipboard.
Clipboard.SetDataObject(myString)
Dim myDataObject As IDataObject = Clipboard.GetDataObject()
' Checks whether the format of the data is 'UnicodeText' or not.
If myDataObject.GetDataPresent(DataFormats.UnicodeText) Then
Console.WriteLine($"Data in 'UnicodeText' format:{myDataObject.GetData(DataFormats.UnicodeText)}")
Else
Console.WriteLine("No String information was contained in the clipboard.")
End If
' Checks whether the format of the data is 'Text' or not.
If myDataObject.GetDataPresent(DataFormats.Text) Then
Dim clipString As String = CType(myDataObject.GetData(DataFormats.StringFormat), String)
Console.WriteLine($"Data in 'Text' format:{clipString}")
End If
Catch e As Exception
Console.WriteLine(e.Message)
End Try
End Sub
End Class
Opmerkingen
Dit veld wordt gebruikt door de IDataObject interface en de DataObject klasse om het gegevenstype op te geven.
Wanneer u toevoegt aan een IDataObject of aan een implementatie van DataObject, gebruikt u dit veld als de indeling voor de IDataObject.SetData en DataObject.SetData methoden.
Als u wilt zien of er een object van dit type bestaat, gebruikt u dit veld als de indeling voor de IDataObject.GetDataPresent en DataObject.GetDataPresent methoden.
Als u een object van dit type wilt ophalen, gebruikt u dit als de indeling voor de IDataObject.GetData en DataObject.GetData methoden.