代码
<navigation:Page x:Class="SLApplicationMadaming.vIEws.第2部分调试.Page_Print" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/Expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:navigation="clr-namespace:System.windows.Controls;assembly=System.windows.Controls.Navigation" d:DesignWIDth="640" d:DesignHeight="480" title="Page_Print Page"> <GrID x:name="LayoutRoot"> <GrID.RowDeFinitions> <RowDeFinition ></RowDeFinition> <RowDeFinition></RowDeFinition> <RowDeFinition Height="40"></RowDeFinition> </GrID.RowDeFinitions> <!--简单的报表--> <border borderBrush="Black" borderThickness="1"> <GrID x:name="reportGrID" GrID.Row="0" ShowGrIDlines="True"> <GrID.Resources> <Style targettype="TextBlock"> <Setter Property="VerticalAlignment" Value="Center"/> <Setter Property="HorizontalAlignment" Value="Center"/> </Style> </GrID.Resources> <GrID.RowDeFinitions> <RowDeFinition Height="30"/> <RowDeFinition Height="30"/> <RowDeFinition Height="30"/> <RowDeFinition Height="30"/> <RowDeFinition Height="30"/> </GrID.RowDeFinitions> <GrID.ColumnDeFinitions> <ColumnDeFinition WIDth="100"/> <ColumnDeFinition WIDth="200"/> <ColumnDeFinition WIDth="300"/> </GrID.ColumnDeFinitions> <TextBlock Text="产品编号" GrID.Row="0" GrID.Column="0"/> <TextBlock Text="产品名称" GrID.Row="0" GrID.Column="1"/> <TextBlock Text="产品大类" GrID.Row="0" GrID.Column="2"/> <TextBlock Text="1" GrID.Row="1" GrID.Column="0"/> <TextBlock Text="数码相机" GrID.Row="1" GrID.Column="1"/> <TextBlock Text="相机" GrID.Row="1" GrID.Column="2"/> <TextBlock Text="2" GrID.Row="2" GrID.Column="0"/> <TextBlock Text="笔记本电脑" GrID.Row="2" GrID.Column="1"/> <TextBlock Text="电脑" GrID.Row="2" GrID.Column="2"/> </GrID> </border> <Canvas GrID.Row="1"> <Canvas.Background> <linearGradIEntBrush StartPoint="0 0" EndPoint="0 1"> <GradIEntStop color="Gray" Offset="0.0"></GradIEntStop> <GradIEntStop color="White" Offset="0.50"></GradIEntStop> </linearGradIEntBrush> </Canvas.Background> </Canvas> <!--打印按钮控件--> <button x:name="btnPrint" GrID.Row="2" Click="btnPrint_Click" WIDth="100" Height="25" Content="打印报表"/> </GrID></navigation:Page>
代码:
using System;using System.Collections.Generic;using System.linq;using System.Net;using System.windows;using System.windows.Controls;using System.windows.@R_419_4617@s;using System.windows.input;using System.windows.Media;using System.windows.Media.Animation;using System.windows.Shapes;using System.windows.Navigation;using System.windows.Printing;namespace SLApplicationMadaming.vIEws.第2部分调试{ public partial class Page_Print : Page { #region 自定义 private System.windows.Printing.Print@R_419_4617@ pd; #region - 方法 #region -- 事件处理 private voID pd_PrintPage(object sender,System.windows.Printing.PrintPageEventArgs e) { //指定打印文档对象的页面 e.PageVisual = LayoutRoot;// reportGrID; } #endregion #region -- 一般方法 private voID PrintSample_Loaded(object sender,RoutedEventArgs e) { //创建打印文档对象 pd = new System.windows.Printing.Print@R_419_4617@(); //创建打印事件,用于指定打印的文档对象作用的对象 pd.PrintPage += new EventHandler<System.windows.Printing.PrintPageEventArgs>(pd_PrintPage); } #endregion #endregion #endregion public Page_Print() { InitializeComponent(); //创建打印文档对象 pd = new System.windows.Printing.Print@R_419_4617@(); //创建打印事件,用于指定打印的文档对象作用的对象 pd.PrintPage += new EventHandler<System.windows.Printing.PrintPageEventArgs>(pd_PrintPage); } // 当用户导航到此页面时执行。 protected overrIDe voID OnNavigatedTo(NavigationEventArgs e) { } private voID btnPrint_Click(object sender,RoutedEventArgs e) { //定义打印的文档名称 //pd.@R_419_4617@name = "产品报表"; //调用打印方法,开始打印 pd.Print ("产品报表"); } }}总结
以上是内存溢出为你收集整理的参考《风云的银光志Silverlight4.0教程之打印报表和图形》实现全部内容,希望文章能够帮你解决参考《风云的银光志Silverlight4.0教程之打印报表和图形》实现所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)