[Mono-winforms-list] Clipboard.SetDataObject() doing nothing

Christoph Teuber christoph.teuber at gmx.li
Sun May 24 07:40:11 EDT 2009


Hello,

thanks for your fast answer.

You were right, there were several changes, but nothing seems to be
connected with my SetDataObject() problem. But I found this statement:

2007-03-18 Jackson Harper <jackson at ximian.com>

* TextBoxBase.cs: Remove image pasting code for now. There is no
way to get an image on the clipboard right now anyways.

This ist from 2007, so it may be out of date, but does it mean, that
copying images to the clipboard doesn't work at all? I wonder, because

Clipboard.SetImage( im );

or

Clipboard.SetObjectData( im );

doesn't do anything either. (im is an image loaded as posted before). In
contrary,

Clipboard.SetObjectData("this is a test");

does work.

Greetings
cht



Stifu wrote:
> I know there've been clipboard fixes after 2.4, so you could check out SVN
> (or bugzilla).
>
>
> cht wrote:
>   
>> Hello, 
>>
>> I'm trying to do some clipboard stuff under Mono right now, and I have the
>> problem, that Windows.Forms.Clipboard.SetDataObject() doesn't seem to do
>> anything if a DataObject will be passed. 
>>
>> I do have the following two pieces of code, which both run under .NET 2.0,
>> but running under mono (2.0.1, Ubuntu 9.04) leaves the clipboard
>> completely unchanged. 
>>
>> private void testButton_Click(object sender, EventArgs e)
>>         {
>>             Image im = (Image)Bitmap.FromFile("test.jpg");            
>>             DataObject dataObj = new DataObject();                        
>>             dataObj.SetData(im.GetType().ToString(), im);
>>             Clipboard.SetDataObject(dataObj, true);
>>              
>>         }
>>
>> private void testTextButton_Click(object sender, EventArgs e)
>>         {
>>             DataObject dataObj = new DataObject();
>>             string format = "System.String";
>>             dataObj.SetData(format, "this is a test");            
>>             Clipboard.SetDataObject(dataObj, false);          
>>         }
>>
>>
>> I compile using VS 2008.
>> As Clipboard.cs seems to bee unchanged since 2.0.1, I didn't try
>> installing Mono 2.4. But I would like to stay compatible to 2.0.1 anyway,
>> so I hope I'm doing something wrong.
>>
>> Anybody any idea, why this is the case? 
>>
>> Thanks in advance 
>> cht
>>
>>
>>     
>
>   



More information about the Mono-winforms-list mailing list