Jump to content
Software FX Community

How to get new RGB color when Fire_ChangeColor()?


User (Legacy)
 Share

Recommended Posts

Hi,

We are using Cfx4032.dll (ver 5.0.6.0) via #import in the

C++ application. The events are captured using the COM-like

approach, as shown in articles:

Q1381010. Handling events in Chart FX DLL

Q1381039. Implementing ICfxEvents. A template

The ChangeColor event handler prototype looks like this:

STDMETHODIMP CCfxEvents::Fire_ChangeColor(int nType,

int nIndex,

DWORD rgbNew);

It seems that rgbNew contains OLE_COLOR instead of COLORREF.

Is it a bug or not? We need that color for custom painting.

Because of that or we need COLORREF or we need to transform

the returned OLE_COLOR to COLORREF. I am not expert in this,

but I guess that we could use OleTranslateColor(). However,

we need the HPALETTE handler. How can we get it?

Thanks,

Petr

--

Petr Prikryl (prikrylp at skil dot cz)

Link to comment
Share on other sites

COLORREF and OLE_COLOR is the same thing. However,in this case, then you

will get a Palette index. We don't expose an hPalette that you could use.

The only way I see here to get the actual color is this:

1) Let the event run so that the color is assigned to the chart.

2) Post yourself a message that tell you which color was just changed.

3) Upon receiving this message (after the ChangeColor event is completed)

query Chart FX for this color, the color will be converted to RGB upon

request.

--

FP

Software FX, Inc.

Link to comment
Share on other sites

(was Re: How to get new RGB color when Fire_ChangeColor()?}

"SoftwareFX Support" wrote...

> [...] in this case, then you will get a Palette index. We

> don't expose an hPalette that you could use. The only way I

> see here to get the actual color is this:

>

> 1) Let the event run so that the color is assigned to the

> chart.

> 2) Post yourself a message that tell you which color was

> just changed.

> 3) Upon receiving this message (after the ChangeColor event

> is completed) query Chart FX for this color, the color will

> be converted to RGB upon request.

Thanks, this works! Anyway, the described approach forces

me to place the code far from the place where I would like

to have it. I still would prefer to process the newRGB

inside the FireChangeColor().

Would it be possible to change the ICfxEvents::Fire_ChangeColor()

behaviour so, that it returned really the newRGB instead of

the index to the palette? Would it break any existing code?

In other words, does it make any sense to return the index

to the palette if I cannot access the palette?

Thanks,

Petr

--

Petr Prikryl (prikrylp at skil dot cz)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...