Printing with other stuff (like a bitmap)
Printing with other stuff (like a bitmap)
Hello -
I need to be able to print a chart, along with a lot of other stuff, including text, lines, a logo (bitmap) etc. One option available to me is to use Rave (ReportPrinter Pro) but I've not run across any examples on how to do this. Another option is to use the custom drawing feature in TChart7, but will this allow me to include the bitmap and lines? Note that all this needs to happen at run time.
Any assistance will be greatly appreciated.
Thanks
Paul
I need to be able to print a chart, along with a lot of other stuff, including text, lines, a logo (bitmap) etc. One option available to me is to use Rave (ReportPrinter Pro) but I've not run across any examples on how to do this. Another option is to use the custom drawing feature in TChart7, but will this allow me to include the bitmap and lines? Note that all this needs to happen at run time.
Any assistance will be greatly appreciated.
Thanks
Paul
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Paul,
Yes, you can custom draw text, lines and bitmaps in TeeChart on the OnAfterDraw event using Canvas methods or also you can draw in the TeePreviewPanel as shown in the features demo and the snippet below:
Yes, you can custom draw text, lines and bitmaps in TeeChart on the OnAfterDraw event using Canvas methods or also you can draw in the TeePreviewPanel as shown in the features demo and the snippet below:
Code: Select all
procedure TForm1.TeePreviewPanel1AfterDraw(Sender: TObject);
var
img: TBitmap;
begin
with TeePreviewPanel1,Canvas do
begin
Font.Color:=clRed;
Font.Size:=12;
TextOut(PaperRect.Left+10,PaperRect.Top+6,'Some text');
MoveTo(0,0);
LineTo(100,100);
img:=TBitmap.Create;
img.LoadFromFile('C:\temp.bmp');
Canvas.Draw(50,50,img);
end;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Paul,
You could have a look at the examples at http://www.nevrona.com/Default.aspx?tabid=73 , Rave Reports website.
You could have a look at the examples at http://www.nevrona.com/Default.aspx?tabid=73 , Rave Reports website.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
I'm missing something regarding the OnAfterDraw. How is the TeePreviewPanel relalated to chart and/or TChartPreviewer? It appears as a separate object on the form.
Also, in some cases I need to bypass the previewer, and send chart (plus all the other bitmaps, etc) directly to the printer. In effect, I need to disallow modifying the format of the output.
Thanks
Paul
Also, in some cases I need to bypass the previewer, and send chart (plus all the other bitmaps, etc) directly to the printer. In effect, I need to disallow modifying the format of the output.
Thanks
Paul
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Paul,
Yes, TeePreviewPanel is a separate component however it needs to have a TChart related.I'm missing something regarding the OnAfterDraw. How is the TeePreviewPanel relalated to chart and/or TChartPreviewer? It appears as a separate object on the form.
If you want to skip a preview panel you can also custom draw on the TChart canvas on TChart's AfterDraw event instead of TeePreviewPanel's AfterDraw event.Also, in some cases I need to bypass the previewer, and send chart (plus all the other bitmaps, etc) directly to the printer. In effect, I need to disallow modifying the format of the output.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Still no go. Please let me know if I got this right. In addition to Chart1, I have a TPreviewPanel, property Chart is set to Chart1. I also have a TChartPreviewer whose Chart property is also set to Chart1. Both TChartPreviewer and TPreviewPanel have a AfterDraw event. I've placed TextOut code in both, but neither show when the preview runs, nor when it prints. The chart prints fine. I've placed break points on the events, and the code does break there, but the text does not appear. What am I missing?
Thanks
Paul
Thanks
Paul
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Paul,
Yes, you got it right. However I meant you could put the custom drawing code at TChart's AfterDraw event as shown here:
This code works for me when printing the chart, can you test if it works for you?
Yes, you got it right. However I meant you could put the custom drawing code at TChart's AfterDraw event as shown here:
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
begin
Series1.FillSampleValues();
end;
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
With Chart1.Canvas do
begin
TextOut(Series1.CalcXPos(0),Series1.CalcYPos(0),'First Point');
TextOut(Series1.CalcXPos(Series1.Count-1),Series1.CalcYPos(Series1.Count-1),'Last Point');
end;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Not quite. The text appears on the Chart, and in the Chart previewer, but does not get printed. Also, I need to print outside the margins of the chart. I was using the code from the demos:
In either case, I do not get text outside the chart margins.
Paul
Code: Select all
with TeePreviewPanel1,Canvas do
begin
Font.Color:=clRed;
Font.Size:=12;
TextOut(PaperRect.Left+10,PaperRect.Top+6,'Some text');
end;
Paul