开发者

How to place multiple formats on the clipboard?

For example, what Wordpad did when I press "Ctrl+C"? It places many different format to clipboard. So Notepad can get the text without any color or font...etc, a开发者_如何学Cnd you still can keep the original format when you paste in another Wordpad window.

The MSDN said I should call SetClipboardData multiple times. But it doesn't work at all.


You can use Delphi's TClipboard.SetAsHandle to put data on the clipboard in as many formats as you want. Open the clipboard first, or else each call to SetAsHandle will clobber whatever else was already there, even in other formats.

Clipboard.Open;
Clipboard.SetAsHandle(cf_Text, x);
Clipboard.SetAsHandle(cf_Bitmap, y);
Clipboard.Close;


All modern programs use OleSetClipboard to publish clipboard formats and data. Start reading here.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜