www.webdeveloper.com
Results 1 to 2 of 2

Thread: Bitmap to Metafile problem

  1. #1
    Join Date
    May 2004
    Posts
    6

    Bitmap to Metafile problem

    //dlg1.Filename is a metafile

    Metafile mf=new Metafile(dlg1.FileName,ipHdc);
    ImageFormat[] aif = { ImageFormat.Bmp, ImageFormat.Gif,ImageFormat.Emf, ImageFormat.Jpeg, ImageFormat.Png, ImageFormat.Tiff };
    grfx.ReleaseHdc(ipHdc);
    grfx = Graphics.FromImage(mf);
    grfx.DrawImage(bm, 0, 0, cx, cy);
    grfx.Dispose();
    try
    {
    mf.Save(dlg1.FileName,aif[2]);
    }
    catch (Exception exc)
    {
    MessageBox.Show(exc.Message, Text);
    }


    In this program of converting a bitmap to a metafile,the above code creates a metafile before using the mf.save line.
    But the size of metafile is larger than the original bmp.

    The mf.Save method creates a metafile but,with some exception,
    "A generic error occured in GDI+".
    while displaying the type of that file using GetType(), it returns bitmap.

    I need to know first, whether a metafile is lesser in size than a bitmap.

    if so, how can i convert a bitmap to a metafile?
    My program , till before the line mf.save(....), creates metafile with
    a size larger than the bitmap i specified.

    So any body, please help em out.
    A.Gayathri

  2. #2
    Join Date
    Jun 2006
    Posts
    1
    Hi,

    I know it's a bit late to react, but I have the same problem you discribed. I was hoping that you have solved the problem by now.

    I just want to create a Metafile in memory, draw something and then save it to a file, but is still get the error message GI+ error.....


    Thanks in Advance!

    Regards,


    Ap

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles