如何在VS2008中将预先格式化的文本粘贴到光标位置?

发布于 2024-07-24 09:14:01 字数 204 浏览 2 评论 0原文

我正在创建一个应用程序来帮助回复电子邮件,因此我得到了一些示例消息,我想从光标位置开始粘贴到电子邮件文本页面中。

想象一下,我得到了带有 Button1、2、3、4 等的应用程序,并且与每个按钮关联的是预先格式化的文本,因此当我点击 Button1 时,它将粘贴文本,从光标位置开始。

是否可以? 执行此操作的代码是什么?

谢谢!

I'm creating an application to help with e-mail replying, so I got a few sample mensages I want to Paste into the e-mail text page, starting from the cursor position.

Imagine, I got this app with Button1,2,3,4 etc, and associated to each button is a pre-formated text, so when I hit Button1 it will Paste the text, starting the cursor location.

Is it possible? And what's the code to do it?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

唱一曲作罢 2024-07-31 09:14:01

您可以使用富文本框作为控件。 如果预先格式化的文本位于剪贴板中,则只需粘贴到富文本框中即可。 富文本框将保持 RTF 格式。 我假设您使用 C# 或 VB.NET。

You can use a Rich Textbox for the control. If the pre-formatted text is in your clipboard it should just be a matter of pasting in the rich textbox. Rich Textbox's will hold formatted for RTF. I'm assuming your using C# or VB.NET.

独孤求败 2024-07-31 09:14:01

我使用的是Visual Studio 2008 Pro,主要使用VB语言。
经过对 MSDN 的长时间研究后,我检查了一些带有剪贴板操作的例程,但我不知道如何正确使用它们。

首先,假设我想在带有换行符的剪贴板格式文本中“插入”...我只设法插入一个字符串,没有任何换行格式。 我真的不需要使用 RTF,Unicode 很适合我,但是......有换行符。

接下来是最困难的工作......如何将剪贴板副本自动写入记事本/Word/任何文本光标。 我知道这要求太多,但如果我可以将格式化文本自动“插入”到剪贴板中,然后自己进行粘贴,我会很高兴。

非常感谢您的帮助!

I'm using the Visual Studio 2008 Pro, mostly with VB language.
After a long research in the MSDN I've checked a few routines with the Clipboard action but I don't know hot to properly use them.

First, imagine I want to "insert" in the Clipboard formated text with line breaks... I only managed to insert a single string, with no kind of line breaking format. I don't really need to use the RTF, Unicode serves me well but... with line breaks.

After that comes the most difficult job... how to write the Clipboard copy automatically into a Notepad/Word/whatever text cursor. I know it's asking too much but I will be happy if I can "insert" formated text automatically into the Clipboard and then make the Paste by myself.

Thanks a lot for the help!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文