[Mono-winforms-list] Mono implementation of Clipboard.GetImage()

Danilo Bargen gezuru at gmail.com
Tue Nov 23 16:36:20 EST 2010


Hello

I'm struggling with retrieving image data from the clipboard using the
System.Windows.Forms.Clipboard.GetImage() method. This is the code I'm
using:

> if ((image = Clipboard.GetImage()) != null)
> {
>     // (...)
> }
> else
> {
>     MessageBox.Show("No image data in clipboard.");
>     Close();
> }

I'm using Ubuntu 10.10 and Mono 2.6.7.

According to Microsoft docs [1], GetImage() should return "an Image
representing the image data in the data object or a null reference if
the data object does not contain any data that is in the Bitmap format
or can be converted to that format". I would assume that even though
Linux probably saves image data (e.g. from a screenshot or by copying
an image from the web) to the clipboard in a different format than
bitmap, C#/Mono should convert it accordingly. This does not seem to
work though.

Additionally, the MonoDevelop debugger does not seem to know GetImage():
> global::System.Windows.Forms.Clipboard.GetImage -
> Unknown Member: GetImage


Can someone help me with this issue? Is this a Mono problem?

Danilo

[1] http://msdn.microsoft.com/en-us/library/system.windows.forms.dataobject.getimage(v=VS.80).aspx


More information about the Mono-winforms-list mailing list