Hi,
I am doing some custom drawing in OnAfterDraw event handler. I have problems with using Chart.Canvas.TextOut and transparent text. I tried different brush settings but I still have some issues.
I usually do Chart.Canvas.Brush.Style := bsClear but I get TextOut with black background. So I tried also Chart.Canvas.Font.Brush.... etc...
Could you explain to me when and how to use different Brushes and when do you use them to draw something?
Chart.Brush (TBrush)
Chart.Canvas.Brush (TTeeBrush)
Chart.Canvad.Font.Brush(TTeeBrush)
Which one should I use to display on Canvas some text with TextOut and transparent background?
Thanks in advance.
Chart brush for custom drawing
Re: Chart brush for custom drawing
Hello,
You have to use the Canvas BackMode (cbmOpaque/cbmTransparent) to deactivate/activate transparency and set the color you wish at the Canvas BackColor. Ie:
You have to use the Canvas BackMode (cbmOpaque/cbmTransparent) to deactivate/activate transparency and set the color you wish at the Canvas BackColor. Ie:
Code: Select all
uses Series, TeCanvas;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
with Chart1.Canvas do
begin
BackMode:=cbmOpaque;
BackColor:=clRed;
TextOut(100, 100, 'Opaque Text Background');
BackMode:=cbmTransparent;
TextOut(100, 120, 'Transparent Text');
end;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.AddSeries(TLineSeries).FillSampleValues;
Chart1.View3D := false;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Chart brush for custom drawing
Thank you for clarifying.