@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The GetEnhMetaFileBits API !!!!C# Signature: [DllImport("gdi32.dll")] static extern uint GetEnhMetaFileBits(IntPtr hemf, uint cbBuffer, [Out] byte [] lpbBuffer); !!!!User-Defined Types: None. !!!!Notes: None. !!!!Tips & Tricks: Please add some! !!!!Sample Code: System.Drawing.Imaging.Metafile metafile = GetMetafileFromSomewhere(); IntPtr hEMF = metafile.GetHenhmetafile(); uint len = GetEnhMetaFileBits(hEMF, 0, null); byte[] rawBytes = new byte[len]; GetEnhMetaFileBits(hEMF, len, result); DeleteEnhMetaFile(hEMF); //Another sample [System.Runtime.InteropServices.DllImport("gdi32")] static extern int GetEnhMetaFileBits(int hemf, int cbBuffer, byte[] lpbBuffer); byte[] GetBytes(Image img) { // use interop to get the metafile bits Metafile mf = img as Metafile; var enhMetafileHandle = mf.GetHenhmetafile().ToInt32(); var bufferSize = GetEnhMetaFileBits(enhMetafileHandle, 0, null); var buffer = new byte[bufferSize]; GetEnhMetaFileBits(enhMetafileHandle, bufferSize, buffer); // return bits return buffer; } !!!!Alternative Managed API: Do you know one? Please contribute it! Documentation: GetEnhMetaFileBits@msdn on MSDN
Edit gdi32.GetEnhMetaF...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.