ASE Home Page Products Download Purchase Support About ASE
ChartDirector Support
Forum HomeForum Home   SearchSearch

Message ListMessage List     Post MessagePost Message

  windows long color to chartdirector
Posted by oded orbach on Jan-08-2013 18:30
hello Peter,
I'm sending long color chosen by common dialog control - color to chartdirector.
the resault color in the chart is different  color (blue turns orange). why?
16744448 - blue.
Tnx

  Re: windows long color to chartdirector
Posted by Peter Kwan on Jan-09-2013 00:04
Hi oded,

There is no standard method to encode color in Windows. Classical controls or components (eg. those for VB6, VBScript, C, C++) tend to encode the colors in BGR. Newer Microsoft languages (eg. C#, VB.NET, VB2005/2008/2010) tend to encode the colors in RGB. HTML also uses RGB.

ChartDirector always use RGB encoding. If you are using colors in BGR format, you would need to swap the Blue and Red channels to convert it to RGB, before passing the color to ChartDirector.

If you are using classical VB6 or VBScript with ChartDirector for ASP/COM/VB, there is a ChartDirector method cd.CColor that can convert OLE Color (including BGR color) into RGB color.

If you are uisng C++, the code is like:

int RGBColor = (int)(((BGRColor & 0xff0000) >> 16) | ((BGRColor & 0xff) << 16) | (BGRColor & 0xff00));

Hope this can help.

Regards
Peter Kwan

  Re: windows long color to chartdirector
Posted by oded orbach on Jan-09-2013 16:53
Thank you for your answer, Peter, but i don't understand.
I use vb6. my input color is long like 12632256. i want to use this color in .addcandlestick(input color i.e 12632256 for up color, second color for down color) in financial chart.
the source of the long color comes from dialog box cdl.color componnent

tnx again, oded

  Re: windows long color to chartdirector
Posted by oded orbach on Jan-09-2013 16:57
continue:
the color source componnent is comctl32.ocx

  Re: windows long color to chartdirector
Posted by Peter Kwan on Jan-10-2013 01:13
Hi oded,

If your color is obtained from comctl32.ocx, please use cd.CColor to change it to ChartDirector format before passing the color to ChartDirector. For example:

Call c.addCandleStick(cd.CColor(myUpColor), cd.CColor(myDownColor))

Hope this can help.

Regards
Peter Kwan

  Re: windows long color to chartdirector
Posted by oded orbach on Jan-10-2013 15:11
Thank you Peter, workes well!!