【TeeChart Pro ActiveX教程】(十四):打印图表

下载TeeChart Pro ActiveX最新版本

标准打印

TeeChart Pro提供标准打印方法,可将“屏幕图表”按原样打印到打印机。

简单打印命令

要打印图表,请使用Print方法。这将打印出屏幕上显示的图表:

[C#]

tChart1.Printer.Print(); 

[VB.Net]

TChart1.Printer.Print()

打印方向

Print方法允许您通过使用布尔横向参数来打印横向和纵向方向,即使它们未被定义为默认方向。打印完成后,默认方向将再次生效。可以使用Landscape属性更改默认方向(对于Landscape,设置为true,对于Portrait,设置为false):

[C#]

tChart1.Printer.Landscape = true; 
tChart1.Printer.Print();

[VB.Net]

TChart1.Printer.Landscape = True 
TChart1.Printer.Print()

打印预览

PrintPreview窗口将显示打印时图表的显示方式。您可以在“打印预览”窗口中修改打印参数。要调用PrintPreview运行:

[C#]

tChart1.Printer.Preview(); 

[VB.Net]

TChart1.Printer.Preview()

灰度打印

当打印到Greyscale打印机时,您应该注意图表的颜色在转换为灰色阴影时很容易区分。为了提供帮助,您可以在图表系列中添加画笔样式,以便在打印时更轻松地区分系列。

您还可以使用灰度属性将彩色图表打印到彩色打印机:

[C#]

tChart1.Printer.Grayscale = true; 
tChart1.Printer.Print(true); 

[VB.Net]

TChart1.Printer.Grayscale = True 
TChart1.Printer.Print(True) 

扩展打印方法

打印多个图表

使用BeginPrint()和EndPrint()将图表发送到打印机而不弹出页面; BeginPrint()和EndPrint()开始和结束打印机作业。可以将多个图表发送到同一页面/打印机作业,也可以包含用户自定义输入。

(将2个图表打印到页面)

[C#]

private void button1_Click(object sender, System.EventArgs e) { 
        tChart1.Printer.BeginPrint(); 
        tChart1.Printer.Print(tChart2.Chart,new Rectangle(100,10,300,200)); 
        tChart1.Printer.Print(new Rectangle(100,300,300,200)); 
        tChart1.Printer.EndPrint(); 
} 

[VB.Net]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
        TChart1.Printer.BeginPrint() 
        TChart1.Printer.Print(TChart2.Chart, New Rectangle(100, 10, 300, 200)) 
        TChart1.Printer.Print(New Rectangle(100, 300, 300, 200)) 
        TChart1.Printer.EndPrint() 
End Sub 

在一个页面上打印预览多个图表

打印预览器现在可以接受多个图表。控制图表位置设置Print方法的Rectangle。

(在打印预览器中显示2个图表)

[C#]

private void button1_Click(object sender, System.EventArgs e) { 
        tChart1.Printer.BeginPrint(); 
        tChart1.Printer.Print(tChart2.Chart,new Rectangle(100,10,300,200)); 
        tChart1.Printer.Print(new Rectangle(100,300,300,200)); 
        tChart1.Printer.Preview(); 
} 

[VB.Net]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
        TChart1.Printer.BeginPrint() 
        TChart1.Printer.Print(TChart2.Chart, New Rectangle(100, 10, 300, 200)) 
        TChart1.Printer.Print(New Rectangle(100, 300, 300, 200)) 
        TChart1.Printer.Preview() 
End Sub 

将打印的图表输出与其他打印输出混合

使用ChartPrint()事件将TeeChart打印输出与非Chart打印机输出混合。 以下示例从TeeChart标题中获取文本,并在具有两个TChart对象的页面上打印它们:

[C#]

private void button1_Click(object sender, System.EventArgs e) { 
        tChart1.Printer.BeginPrint(); 
        tChart1.Printer.Print(tChart2.Chart,new Rectangle(100,10,300,200)); 
        tChart1.Printer.Print(new Rectangle(100,300,300,200)); 
        tChart1.Printer.EndPrint(); 
} 
 
private void tChart1_ChartPrint(object sender, System.Drawing.Printing.PrintPageEventArgs e) { 
        e.Graphics.DrawString("Chart: "+((Steema.TeeChart.ChartPrintJob)sender).Chart.Header.Text, 
            this.Font,new SolidBrush(Color.Black),100,((Steema.TeeChart.ChartPrintJob)sender).ChartRect.Bottom+10); 
} 

[VB.Net]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
        TChart1.Printer.BeginPrint() 
        TChart1.Printer.Print(TChart2.Chart, New Rectangle(100, 10, 300, 200)) 
        TChart1.Printer.Print(New Rectangle(100, 300, 300, 200)) 
        TChart1.Printer.EndPrint() 
End Sub 
 
Private Sub TChart1_ChartPrint(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles TChart1.ChartPrint 
        e.Graphics.DrawString("Chart: " & (CType(sender, Steema.TeeChart.ChartPrintJob)).Chart.Header.Text, _ 
        Me.Font, New SolidBrush(Color.Black), 100, (CType(sender, Steema.TeeChart.ChartPrintJob)).ChartRect.Bottom + 10) 
End Sub 
=========================================== TeeChart Pro Activex Control v5 Copyright (c) 1997-2002 by David Berneda and Marc Meumann All Rights Reserved. http://www.steema.com email: info@steema.com supportx@steema.com =========================================== July 2002 TeeChart Pro Activex Control v5 v5.0.4.0 Release notes: ===================================== For information about differences and use of TeeChart Pro ActiveX v5 with respect to TeeChart Pro ActiveX v4 please refer to the 'Upgrading from TeeChart v4.doc' document accessible via the TeeChart Program Manager group. =========================================== Changes for this release: ------------------------- Bugs resolved: 1. Print Preview from TeeCommander for multi-page Charts in v5.0.3.x functioned incorrectly. Now resolved. 2. ZoomPen definition failed to save in tee files. Now resolved. 3. Integer overflow error reported after multiple zooms. Now resolved. 4. The property 'Controls' in TeeCommander coincides with a protected word in VBA. To permit access to this functionality in VBA the method has been duplicated with name 'Buttons'. 5. Omission in previous releases, the OffsetValues ValueList for Bar3D Series is accessible by code for this release. 6. Omission in previous releases, MACD function has new Period3 property. 7. Visual Studio.NET doesn't support the passing as Interface of the Chart to the TeePreviewPanel AddChart method. A substitute AddChartLink has been added for this release to accept ChartLink. 8. The keyword 'Months' as a database field name was incompatible with prior translation system for non-english language versions' db access via the Editor. Now resolved. 9. TeePolar/Radar Series problem when labelling datasets of 13, 19, 25, etc. values. Internal rounding error resolved. 10.Help button on Chart Editor not functioning. Now resolved. New features: 1.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值