Recent

Author Topic: textout  (Read 12021 times)

acp693

  • Jr. Member
  • **
  • Posts: 59
textout
« on: June 18, 2009, 03:57:55 pm »
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: [Select]
case FStyle of
      psletters: begin
        ACanvas.pen.color := Acolor;
        ACanvas.TextOut(px,py,'S');
      end;           
   

Zaher

  • Hero Member
  • *****
  • Posts: 578
    • parmaja.com
Re: textout
« Reply #1 on: June 18, 2009, 05:31:44 pm »
change Canvas.TextStyle.Opaque

acp693

  • Jr. Member
  • **
  • Posts: 59
Re: textout
« Reply #2 on: June 18, 2009, 05:57:31 pm »
Thanks but after adding the line:
Code: [Select]
case FStyle of
      psletters: begin
        ACanvas.TextStyle.opaque :=false;
        ACanvas.pen.color := Acolor;
        ACanvas.TextOut(px,py,'S');
      end;             

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

Any ideas anyone?

Thanks

Albert

acp693

  • Jr. Member
  • **
  • Posts: 59
Re: textout
« Reply #3 on: June 18, 2009, 09:08:43 pm »
I've found out the problem.
Canvas.TextStyle.opaque :=false; only applies to TextRect, not TextOut.
Changing the lines to:
Code: [Select]
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');  
fixes the problem.
Regards

Albert

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 5800
    • wiki
Re: textout
« Reply #4 on: June 20, 2009, 12:46:05 am »
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);