Page 1 of 1

Get canvas pixel color

Posted: Fri Mar 10, 2017 12:35 am
by 16579547
I am trying to obtain a pixel color in the OnAfterDraw event with

Code: Select all

X := Chart1.BottomAxis.CalcPosValue(XCoord);
Y :=Chart1.LeftAxis.CalcPosValue(YCoord);
AColor:=Chart1.Canvas.Pixels[X,Y];
But this always returns claWhite even though I have applied color fill with the Series Region Tool during the plotting.

Re: Get canvas pixel color

Posted: Mon Mar 13, 2017 9:30 am
by yeray
Hello,

We can't map the pixels as we are drawing elements directly in the canvas.
If you activate UseBuffer to use an internal bitmap, then it should work:

Code: Select all

Chart1.Canvas.UseBuffer:=True;