User (Legacy) Posted August 21, 2002 Report Share Posted August 21, 2002 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 More sharing options...
Software FX Posted August 21, 2002 Report Share Posted August 21, 2002 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 More sharing options...
User (Legacy) Posted August 22, 2002 Author Report Share Posted August 22, 2002 (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 More sharing options...
Software FX Posted August 26, 2002 Report Share Posted August 26, 2002 Yes, I agree it would make better sense to send the actual color but this change will break existing code so we can not do it. -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.