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
Print Problem
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 :
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
Pep Jorge
http://support.steema.com
http://support.steema.com