Cannot find a previous reference to this.
Essentially
I have a TeePreviewPanel named tppPrint
I add 2 charts to this
tppPrint.addChart chart1
tppPrint.addChart chart2
The title is set on the OnAfterDraw event as follows
With tppPrint.Canvas
.TextOut x, y, "title"
End With
Also tried the
tppPrint.Title = "Title"
But this has no effect
This appears fine on the Preview Panel but when the object is printed it loses the title.
Title does not appear on the printed page (TeePreviewPanel)
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi dineena,
To print elements that are not into the chart area you should use something like the code below:
To print elements that are not into the chart area you should use something like the code below:
Code: Select all
Private Sub Command1_Click()
Dim HWidth, HHeight, ChartLeft, ChartTop, ChartRight, ChartBottom ' Declare variables.
On Error GoTo ErrorHandler ' Set up error handler.
Printer.Orientation = vbPRORPortrait
'Scale & position text.
HWidth = Printer.TextWidth(Text1.Text) / 2 ' Get half width.
HHeight = Printer.TextHeight(Text1.Text) / 2 ' Get half height.
Printer.CurrentX = Printer.ScaleWidth / 3 - HWidth
Printer.CurrentY = Printer.ScaleHeight / 3 - HHeight
Printer.Print Text1.Text ' Print 1st Text box
With TChart1.Printer
'Chart needs to orientated separately
.Orientation = poPortrait
'Set the chart position
ChartLeft = .PageWidth / 3
ChartTop = (.PageHeight / 3) + 30
ChartRight = (.PageWidth / 3) * 2
ChartBottom = (2 * (.PageHeight / 3)) - HHeight - 10
'Attach the Chart output to the open print job
.PrintPartialHandle Printer.hDC, ChartLeft, _
ChartTop, ChartRight, ChartBottom
End With
Printer.CurrentY = 2 * Printer.ScaleHeight / 3 - HHeight
Printer.CurrentX = Printer.ScaleWidth / 3 - HWidth
Printer.Print Text2.Text ' Print 2nd Text box
Printer.EndDoc ' Printing is finished.
Exit Sub
ErrorHandler:
MsgBox "There was a problem printing to your printer."
Exit Sub
End Sub
Private Sub Form_Load()
Text1.Text = "This first text box should be placed on top of the TeeChart Object."
With TChart1
.AddSeries scLine
.Series(0).FillSampleValues 100
End With
Text2.Text = "This second text box should be placed below the TeeChart Object."
End Sub
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 |