Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Creating a vectorized metafile (wmf)

Creating a vectorized metafile (wmf)

Scheduled Pinned Locked Moved C#
graphicsdata-structureshelptutorialquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jjansen
    wrote on last edited by
    #1

    Does anyone know how to construct a vectorized (not a rasterized!, i.e. not a bitmap) metafile? I've tried the code below, but all I get a rasterized picture (I suspect it to be a PNG :wtf: ). Metafile MyMetafile = null; using (Graphics RefGraph = Graphics.FromHwnd(IntPtr.Zero)) { IntPtr RefDC = RefGraph.GetHdc(); // Make the metafile: MyMetafile = new Metafile(RefDC, new Rectangle(0, 0, MyWidth, MyHeight), MetafileFrameUnit.Pixel); RefGraph.ReleaseHdc(RefDC); } using (Graphics Graph = Graphics.FromImage(MyMetafile)) { // Draw: Brush Br = new SolidBrush(Color.Blue); Graph.FillRectangle(Br, 0, 0, MyWidth / 2, MyHeight / 2); // ... more line drawing. } MyMetafile.Save(@"c:\temp\test.wmf", ImageFormat.Wmf); I'm using a screen device context as a basis for the metafile since a reference DC is required when recording a metafile. Maybe that's what's wrong, because this screen DC is rasterized. But I don't know how to get a vectorized DC or if such a thing even exists. Or maybe I'm on the wrong track. Any help on how to make a vectorized wmf or emf would be helpful. Thanks.

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups