Reputation: 53
I'm trying to create a Server/Client application for sending Clipboard data to and from all connected clients (particularly OneNote 2010 Clipboard data) I am trying to copy drawings (with text boxes) out of OneNote into an IDataObject, and then back into OneNote. The only problem is that when I copy the data back onto the clipboard and paste it. The Text has been lost and I only have the drawing. How can I preserve the clipboard data to be as though it never left OneNote?
private void sendButton_Click(object sender, EventArgs e)
{
clipboard = Clipboard.GetDataObject();
//SendData(clipboard);
for(int i = 0; i< clipboard.GetFormats(true).Length;i++)
{
chatHist.Text += clipboard.GetFormats(true)[i] + Environment.NewLine;
}
}
private void getButton_Click(object sender, EventArgs e)
{
Clipboard.SetDataObject(clipboard,true);
}
Upvotes: 1
Views: 691
Reputation: 4407
You should place multiple data formats on the clipboard for this. This can be done using the DataObject class.
Upvotes: -1