Page 1 of 1
Print Problem
Posted: Thu Jul 22, 2004 12:03 pm
by 9079147
Hello,
I'm new to this newsgroup and have a simple question. I'm using Teechart Pro 6.0
I want to print a whole graph including the panel with its backcolor but when I use the ShowPreview-Method the background everytime has a white color.
Could anybody please tell me, how I can manage to print with the correct background color.
Thanks in advance.
Dirk
Posted: Thu Jul 22, 2004 4:31 pm
by Pep
Hi Dirk,
yes, this cannot be done with the actual version, it's on our wish list as as feature request to be considered for future releases. In meantime, a workaround could be to use the following code :
Code: Select all
Dim Printing As Boolean
Private Sub Command1_Click()
Printing = True
TChart1.Repaint
TChart1.Printer.PrintChart
Printing = False
TChart1.Repaint
End Sub
Private Sub Form_Load()
Printing = False
With TChart1
.AddSeries scLine
.Series(0).FillSampleValues 10
.Axis.Bottom.Labels.Font.Color = vbWhite
.Axis.Left.Labels.Font.Color = vbWhite
.Frame.Color = vbWhite
.Axis.Bottom.GridPen.Visible = False
.Axis.Left.GridPen.Visible = False
End With
End Sub
Private Sub TChart1_OnBeforeDrawChart()
If Printing = True Then
Dim MyLeft, MyTop, MyRight, MyBottom As Double
With TChart1
.Canvas.Brush.Color = vbBlack
MyLeft = .Canvas.Left - .Axis.Left.Position
MyTop = .Canvas.Top - .Axis.Top.Position
MyBottom = .Canvas.Height - .Axis.Bottom.Position
MyRight = .Canvas.Width - .Axis.Right.Position
.Canvas.Rectangle .Axis.Left.Position + MyLeft, .Axis.Top.Position + MyTop, .Axis.Right.Position - MyRight, .Axis.Bottom.Position - MyBottom
End With
Else
With TChart1
.Canvas.Brush.Color = vbBlack
.Canvas.Rectangle .Canvas.Left, .Canvas.Top, .Canvas.Width, .Canvas.Height
End With
End If
End Sub
Posted: Tue Jul 27, 2004 8:15 am
by 9079147
Hi,
first of all thanks for your fast answer.
I solved the problem in another way. I changed the gradient startcolor, midcolor and endcolor to the panel color and then the background was printed in the correct way.