I could use Sendkeys.Send("^c") to copy to clipboard.
How do I store the contents of the clipboard to a variable?
Depending on format:
if (Clipboard.ContainsAudio())
{
var audio = Clipboard.GetAudioStream();
[..]
}
if (Clipboard.ContainsFileDropList())
{
var list = Clipboard.GetFileDropList();
[..]
}
if (Clipboard.ContainsImage())
{
var image = Clipboard.GetImage();
[..]
}
if (Clipboard.ContainsText(TextDataFormat.Html))
{
var text = Clipboard.GetText(TextDataFormat.Html);
[..]
}
string setText = "somedata";
Clipboard.SetText(setText);//copy text from variable to Clipboard
string getText=Clipboard.GetText();// copy text from Clipboard to variable
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.