Forum > TAChart

textout

(1/1)

acp693:
Hi,

I have added the following case to the procedure TSeriesPointer.Draw(ACanvas: TCanvas; px, py: Integer; AColor: TColor) that is found in Unit TASeries.

 I would like to print letters on my charts instead of the symbols supplied. The code works, but the letter appears on a solid colored background, whereas, I would like a transparent background. Is this possible?

Regards

Albert


--- Code: ---case FStyle of
      psletters: begin
        ACanvas.pen.color := Acolor;
        ACanvas.TextOut(px,py,'S');
      end;           
--- End code ---
   

Zaher:
change Canvas.TextStyle.Opaque

acp693:
Thanks but after adding the line:

--- Code: ---case FStyle of
      psletters: begin
        ACanvas.TextStyle.opaque :=false;
        ACanvas.pen.color := Acolor;
        ACanvas.TextOut(px,py,'S');
      end;             
--- End code ---

I still get a solid green rectangle with the letter s printed on it.

Any ideas anyone?

Thanks

Albert

acp693:
I've found out the problem.
Canvas.TextStyle.opaque :=false; only applies to TextRect, not TextOut.
Changing the lines to:
--- Code: ---case FStyle of
      psletters: begin
        ACanvas.TextStyle.Opaque:=false;
        Acanvas.Font.Color:=clred;
        ARect:=rect(px-20,py-20,px+20,py+20);
        ACanvas.Textrect(ARect,px, py, 'S');  
--- End code ---
fixes the problem.
Regards

Albert

Martin_fr:
I don't know if canvas has a property for this, but another thing that may or may not help (with textout) could be

  SetBkMode(Canvas.handle, TRANSPARENT);

Navigation

[0] Message Index

Go to full version