C#发送数据到剪贴板及从剪贴板中取数据的方法
作者:DTC2 时间:2021-06-06 15:28:38
本文实例讲述了C#发送数据到剪贴板及从剪贴板中取数据的方法。分享给大家供大家参考。具体如下:
1. 发送数据到剪贴板
using System.Windows.Forms;
Clipboard.SetText("test");
2. 从剪贴板中取数据
using System.Windows.Forms;
IDataObject iData = Clipboard.GetDataObject();
if (iData.GetDataPresent(DataFormats.Text))
{
MessageBox.Show((string)iData.GetData(DataFormats.Text));
}
else
MessageBox.Show("目前剪贴板中数据不可转换为文本","错误");
希望本文所述对大家的C#程序设计有所帮助。
标签:C#,剪贴板
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
Springboot通过run启动web应用的方法
2021-08-30 01:57:37
![](https://img.aspxhome.com/file/2023/7/64527_0s.png)
Mybatis如何获取最新插入数据的id
2023-02-26 08:15:20
C#基础:基于const与readonly的深入研究
2023-09-26 14:22:30
![](https://img.aspxhome.com/file/2023/7/102297_0s.jpg)
JAVA基于SnakeYAML实现解析与序列化YAML
2023-11-26 06:14:44
Maven中的SnapShot版本和正式版本的区别
2023-11-03 16:31:46
关于@Autowired注入依赖失败的问题及解决
2023-11-29 00:50:42
![](https://img.aspxhome.com/file/2023/4/60474_0s.png)
如何解决修改StaticText的字体
2023-05-25 08:40:14
![](https://img.aspxhome.com/file/2023/9/66699_0s.png)
详解SpringBoot使用RedisTemplate操作Redis的5种数据类型
2022-12-03 07:35:29
![](https://img.aspxhome.com/file/2023/0/75010_0s.png)
java用户名密码验证示例代码分享
2021-10-14 08:16:14
SpringBoot security安全认证登录的实现方法
2021-05-30 08:09:56
![](https://img.aspxhome.com/file/2023/5/63685_0s.png)
java取两个字符串的最大交集
2021-07-30 17:23:08
mybatis-plus查询源码详解
2023-02-02 11:58:02
![](https://img.aspxhome.com/file/2023/0/61300_0s.png)
详解c# 多态
2021-12-07 07:12:40
![](https://img.aspxhome.com/file/2023/3/79113_0s.png)
基于WPF实现用户头像选择器的示例代码
2022-07-07 16:48:18
SpringBoot 整合mybatis+mybatis-plus的详细步骤
2022-09-29 21:06:10
![](https://img.aspxhome.com/file/2023/5/72915_0s.png)
C#索引属性用法实例分析
2023-02-02 14:15:19
C#利用反射来判断对象是否包含某个属性的实现方法
2023-02-26 06:57:52
Android开发中MotionEvent坐标获取方法分析
2022-03-29 02:43:42
![](https://img.aspxhome.com/file/2023/0/93280_0s.png)
解决logback-classic 使用testCompile的打包问题
2021-07-01 08:16:50
Java基础学习之字符串知识总结
2021-06-30 10:23:56
![](https://img.aspxhome.com/file/2023/9/84209_0s.png)