Add alpha to enhanced metafile

165 Views Asked by At

I am creating an enhanced metafile, which I am drawing a graph to. The graph highlights sections in red, using an alpha of 40 to give it some transparency. When the file is saved the alpha is abscent and what looks like Windows using a balance of white/red instead. My question is how can I set the metafile so that it will include the alpha?

Target alpha:

enter image description here

Actual:

enter image description here

Code to make Enhanced Metafile:

Dim gfx As Graphics = Form1.CreateGraphics
Dim hDcRef As IntPtr = gfx.GetHdc
Dim rc As RECT
Dim hDcEmf As IntPtr = CreateEnhMetaFile(hDcRef, "c:\new", rc, Nothing)

gfx.ReleaseHdc(hDcRef)
gfx.Dispose()

Dim g = Graphics.FromHdc(hDcEmf)
Graph.Draw(g)

Dim hEmf As IntPtr = CloseEnhMetaFile(hDcEmf)
g.Dispose()

Can provide the calls to GDI+ dll also if needed.

0

There are 0 best solutions below