怎么在当前输入框粘贴文本?

mutouren168 2014-04-29 04:57:01
怎么在当前输入框粘贴剪贴板中的文本?
模拟CTRL+V就算了,有高手知道不,,,
...全文
218 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
小恒丶 2014-04-30
  • 打赏
  • 举报
回复
引用 10 楼 u011588826 的回复:
[quote=引用 9 楼 wg5945 的回复:]
粘贴:
private void button2_Click(object sender, System.EventArgs e) {
  // Declares an IDataObject to hold the data returned from the clipboard.
  // Retrieves the data from the clipboard.
  IDataObject iData = Clipboard.GetDataObject();
   
  // Determines whether the data is in a format you can use.
  if(iData.GetDataPresent(DataFormats.Text)) {
  // Yes it is, so display it in a text box.
  textBox2.Text = (String)iData.GetData(DataFormats.Text); 
  }
 }
这么大的粘贴两个字你没看到?
看到了,那我问你,他能粘贴到游戏和其他程序 里面么? [/quote] 你试都不试就问别人到底可不可以 别人都说是复制了啊。自己多动手试看看
mutouren168 2014-04-29
  • 打赏
  • 举报
回复
引用 9 楼 wg5945 的回复:
粘贴:
private void button2_Click(object sender, System.EventArgs e) {
  // Declares an IDataObject to hold the data returned from the clipboard.
  // Retrieves the data from the clipboard.
  IDataObject iData = Clipboard.GetDataObject();
   
  // Determines whether the data is in a format you can use.
  if(iData.GetDataPresent(DataFormats.Text)) {
  // Yes it is, so display it in a text box.
  textBox2.Text = (String)iData.GetData(DataFormats.Text); 
  }
 }
这么大的粘贴两个字你没看到?
看到了,那我问你,他能粘贴到游戏和其他程序 里面么?
wg5945 2014-04-29
  • 打赏
  • 举报
回复
粘贴:
private void button2_Click(object sender, System.EventArgs e) {
  // Declares an IDataObject to hold the data returned from the clipboard.
  // Retrieves the data from the clipboard.
  IDataObject iData = Clipboard.GetDataObject();
   
  // Determines whether the data is in a format you can use.
  if(iData.GetDataPresent(DataFormats.Text)) {
  // Yes it is, so display it in a text box.
  textBox2.Text = (String)iData.GetData(DataFormats.Text); 
  }
 }
这么大的粘贴两个字你没看到?
mutouren168 2014-04-29
  • 打赏
  • 举报
回复
引用 7 楼 wg5945 的回复:
复制:
private void button1_Click(object sender, System.EventArgs e) {
  // Takes the selected text from a text box and puts it on the clipboard.
  if(textBox1.SelectedText != ”")
  Clipboard.SetDataObject(textBox1.SelectedText);
  }

粘贴:
private void button2_Click(object sender, System.EventArgs e) {
  // Declares an IDataObject to hold the data returned from the clipboard.
  // Retrieves the data from the clipboard.
  IDataObject iData = Clipboard.GetDataObject();
  
  // Determines whether the data is in a format you can use.
  if(iData.GetDataPresent(DataFormats.Text)) {
  // Yes it is, so display it in a text box.
  textBox2.Text = (String)iData.GetData(DataFormats.Text); 
  }
 }
我想要的是粘贴功能,不是赋值哎。 我想写个粘贴器 ,因为游戏屏蔽CTRL+V按键,我又找不到粘贴对应的API
wg5945 2014-04-29
  • 打赏
  • 举报
回复
复制:
private void button1_Click(object sender, System.EventArgs e) {
  // Takes the selected text from a text box and puts it on the clipboard.
  if(textBox1.SelectedText != ”")
  Clipboard.SetDataObject(textBox1.SelectedText);
  }

粘贴:
private void button2_Click(object sender, System.EventArgs e) {
  // Declares an IDataObject to hold the data returned from the clipboard.
  // Retrieves the data from the clipboard.
  IDataObject iData = Clipboard.GetDataObject();
  
  // Determines whether the data is in a format you can use.
  if(iData.GetDataPresent(DataFormats.Text)) {
  // Yes it is, so display it in a text box.
  textBox2.Text = (String)iData.GetData(DataFormats.Text); 
  }
 }
mutouren168 2014-04-29
  • 打赏
  • 举报
回复
引用 5 楼 xdashewan 的回复:
内容你都获取了,还没办法展示?你写的是程序吗
游戏屏蔽CTRL+V按键,我想写个粘贴器
xdashewan 2014-04-29
  • 打赏
  • 举报
回复
内容你都获取了,还没办法展示?你写的是程序吗
mutouren168 2014-04-29
  • 打赏
  • 举报
回复
引用 2 楼 xdashewan 的回复:
用Clipboard
string data = Clipboard.GetText(TextDataFormat.UnicodeText);
这个是获得内容,我是想把内容显示出来,其实就是 CTRL+V,但是不知道他的API是什么
mutouren168 2014-04-29
  • 打赏
  • 举报
回复
引用 1 楼 m593192219 的回复:
读取剪贴板内容,判断是文本就显示
咋显示
xdashewan 2014-04-29
  • 打赏
  • 举报
回复
用Clipboard
string data = Clipboard.GetText(TextDataFormat.UnicodeText);
多啦A孟 2014-04-29
  • 打赏
  • 举报
回复
读取剪贴板内容,判断是文本就显示
## 软件功能详细介绍 1. **文本片段管理**:可以添加、编辑、删除常用文本片段,方便快速调用 2. **分组管理**:支持创建多个分组,不同类型的文本片段可以分类存储 3. **热键绑定**:为每个文本片段绑定自定义热键,实现一键粘贴 4. **窗口置顶**:支持窗口置顶功能,方便在其他应用程序上直接使用 5. **自动隐藏**:可以设置自动隐藏,减少桌面占用空间 6. **数据持久化**:所有配置和文本片段会自动保存,下次启动时自动加载 ## 软件使用技巧说明 1. **快速添加文本**:在文本输入框中输入内容后,点击"添加内容"按钮即可快速添加 2. **批量管理**:可以同时编辑多个文本片段,提高管理效率 3. **热键冲突处理**:如果设置的热键与系统或其他软件冲突,会自动提示 4. **分组切换**:使用分组按钮可以快速切换不同类别的文本片段 5. **文本格式化**:支持在文本片段中使用换行符和制表符等格式 ## 软件操作方法指南 1. **启动软件**:双击"大飞哥软件自习室——快捷粘贴工具.exe"文件即可启动 2. **添加文本片段**: - 在主界面的文本输入框中输入要保存的内容 - 点击"添加内容"按钮 - 在弹出的对话框中设置热键和分组 - 点击"确定"保存 3. **使用热键粘贴**: - 确保软件处于运行状态 - 在需要粘贴的位置按下设置的热键 - 文本片段会自动粘贴当前位置 4. **编辑文本片段**: - 选中要编辑的文本片段 - 点击"编辑"按钮 - 修改内容或热键设置 - 点击"确定"保存修改 5. **删除文本片段**: - 选中要删除的文本片段 - 点击"删除"按钮 - 在确认对话框中点击"确定"即可删除

111,120

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧