Infrastructure Map Server Forum
Welcome to Autodesk’s Infrastructure Map Server Forums. Share your knowledge, ask questions, and explore popular Infrastructure Map Server topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting the Image from clipboard (after copyMap)

1 REPLY 1
Reply
Message 1 of 2
spine
227 Views, 1 Reply

Getting the Image from clipboard (after copyMap)

Hi everyone.

How is it possible to retrieve the image from the clipboard (>IE 5.5) and using it as an Image in javascript. I've tried the clipboardData object using the getData method but it doesn't return an Image (only text and url's). Does anyone know?

Øivind
1 REPLY 1
Message 2 of 2
joaobarnabe
in reply to: spine

In C# use that code:

using System.Runtime.InteropServices;
using System.Reflection;

public const uint CF_METAFILEPICT = 3;
public const uint CF_ENHMETAFILE = 14;

[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern bool OpenClipboard(IntPtr hWndNewOwner);

[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern bool CloseClipboard();

[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern IntPtr GetClipboardData(uint format);

[DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)]
public static extern bool IsClipboardFormatAvailable(uint format);


private void gravarComoImagemToolStripMenuItem_Click(object sender, EventArgs e)
{

axMGMap1.copyMap();
if (OpenClipboard(this.Handle))
{
if (IsClipboardFormatAvailable(CF_ENHMETAFILE))
{
IntPtr ptr = GetClipboardData(CF_ENHMETAFILE);
if (!ptr.Equals(new IntPtr(0)))
{
Metafile metafile = new Metafile(ptr, true);
Image imagem = metafile;
string ficheiro_destino = saveimageasfile();
imagem.Save(@"c:\teste.jpg", ImageFormat.Jpeg);
}
}
CloseClipboard();
}
}

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report