Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to change color of an existing Enhanced MetaFile?

28 views
Skip to first unread message

Rolf Diermann

unread,
Nov 2, 1997, 3:00:00 AM11/2/97
to

This will not work. The enhanced metafile is a recorded
sequence of GDI calls. Your enhanced metafile could contain
hundreds of e.g. SetTextColor, CreatePen records and
in general they would be used to set different colors. Thus it is
not meaningful to set the color "before" playing the metafile.
Probably your problem is not really solveable, because
you do not know the structure of the metafile and it
might change depending on the 3'rd party software.

But you can try to use the "EnumEnhMetaFile" function.
In the callback you will be able to detect each single
call to SetTextColor. You should not change the contents
of the records passed to this callback. Instead you could
use SetTextColor with your own color value and omit the
standard call to PlayEnhMetaFileRecord.

While this is the key to solve your problem, it is not easy.
Color is introduced by various GDI calls. You also will
have to monitor records for CreatePen, CreateSolidBrush
etc.

Rolf
(1997 should be removed from my email address)

Christian Fürst <christi...@enator.se> wrote in article
<01bce60c$b337dcf0$420a0d93@chfu>...
>
> I'm using a 3'rd-party dll that transfers filedata to memory available to
> my application.
> I then "create a memory-based enhanced-format metafile from supplied
data"
> with SetEnhMetaFileBits(...) and can play it with PlayEnhMetaFile(...).
> Works fine.
>
> What I want to do is dynamically change the color of it once in a while.
>
> I have tried to define and ::SelectObject a HPEN before calling
> PlayEnhMetaFile(...) but the lines of the file are still black.
> I have tried to ::CreatePalette, ::SelectPalette, ::RealizePalette before
> calling PlayEnhMetaFile(...). The same result!
>
> Has anyone tried to change the color (with or without success), tell me!


0 new messages