I know this is asked many times before but it s not what i look for, to make copy paste in c# we use;
//Copy
Clipboard.SetDataObject("String to copy");
//Paste
IDataObject iData = Clipboard.GetDataObject();
I only want to use copy, after using:
Clipboard.SetDataObject("String to copy");
when i close the program, then when i right click and paste on a txt file nothing happens!
So Clipboard class seems doesnt help, so i need another solution.
Clipboard.SetDataObject("String to copy", true);
末尾的布尔值指定在应用程序关闭后是否应将字符串保留在剪贴板中,并且默认设置为false。
You want to use second overload of SetDataObject(object, bool) .
When bool
is set to true
, data will remain after application is closed.
Did you try to use Clipboard.SetText(your_String)
?
This works for me.
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.