登录
首页 » C#源码 » C# WPF 功能打印的示例

C# WPF 功能打印的示例

于 2022-01-23 发布 文件大小:26.74 kB
0 300
下载积分: 2 下载次数: 1

代码说明:

C# WPF 功能打印的示例,加载内容后,可在本程序中直接打印出XAML文档。   private void button2_Click(object sender, RoutedEventArgs e)   {//打印文件    PrintDialog MyDialog = new PrintDialog();    if ((MyDialog.ShowDialog() == true))    {    MyDialog.PrintVisual(this.richTextBox1 as Visual, "我的XAML打印文档");    }   }   private void button3_Click(object sender, RoutedEventArgs e)   {//保存文件    string MyFileName = "MyFile.XAML";    TextRange MyTextRange;    System.IO.FileStream MyStream;    MyTextRange = new TextRange(this.richTextBox1.Document.ContentStart, this.richTextBox1.Document.ContentEnd);    MyStream = new System.IO.FileStream(MyFileName, System.IO.FileMode.Create);    MyTextRange.Save(MyStream, DataFormats.XamlPackage);    MyStream.Close();   }

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • 7Zip
    This file is part of SevenZipSharp.    SevenZipSharp is free software: you can redistribute it and/or modify    it under the terms of the GNU Lesser General Public License as published by    the Free Software Foundation, either version 3 of the License, or    (at your option) any later version.    SevenZipSharp is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU Lesser General Public License for more details.    You should have received a copy of the GNU Lesser General Public License    along with SevenZipSharp.  If not, see .
    2022-07-20 00:09:31下载
    积分:1
  • C# 房屋中介系统文档+
    C# 房屋中介系统文档+源代码,这是一本书中的范例,来自明日科技,这个房屋中介系统可以很容易扩展成一个功能强大的中介系统,而不局限于房屋的中介。系统功能:用户信息管理、求租管理、员工信息、出租管理、交费管理、业务统计、常用工具、系统管理等。这套房屋中介系统的界面也是挺不错的,有点专业范,左侧有树状菜单等。
    2023-06-28 09:40:03下载
    积分:1
  • CA ciso
    数字证书的demo程序,用于KPI建设。基于openssl实现。采用vc6.0编译。
    2022-06-28 03:32:13下载
    积分:1
  • C# SQL语句查询指定区间内的数据库内容
    C# 查询数据库信息,具体到本例中,是查询第10到第20名的数据,这在平时的数据库运用中,十分实用,比如查询指定区间内的成绩、销售业绩等,将查询出的数据给予一定的等级,本程序查询到的数据将返回DataTable对象:   string P_Str_ConnectionStr = string.Format(//创建数据库连接字符串    @"server=WIN-GI7E47AND9RLS;database=db_TomeTwo;uid=sa;pwd=");   string P_Str_SqlStr = string.Format(//创建SQL查询字符串    @"SELECT TOP 10 * FROM (SELECT TOP 20 * FROM tb_Grade ORDER BY 总分 DESC) AS st ORDER BY 总分 ASC");   SqlDataAdapter P_SqlDataAdapter = new SqlDataAdapter(//创建数据适配器    P_Str_SqlStr, P_Str_ConnectionStr);   DataTable P_dt = new DataTable();//创建数据表   P_SqlDataAdapter.Fill(P_dt);//填充数据表   return P_dt;//返回数据表
    2022-11-06 22:25:03下载
    积分:1
  • C# SelectionStart SelectionEnd时间段选择日历范例
    C# Calendar 时间段选择日历范例,可选择时间区间,调用 了C#中的SelectionStart SelectionEnd日期函数实现的功能,这个程序演示了两种功能:   1、获取控件当前的日期和时间   textBox1.Text = monthCalendar1.TodayDate.ToString();   2、时间起始段的选择:   通过SelectionStart属性获取用户选择的起始日期   textBox2.Text = monthCalendar1.SelectionStart.ToString();   通过SelectionEnd属性获取用户选择的结束日期   textBox3.Text = monthCalendar1.SelectionEnd.ToString();
    2022-08-15 10:37:28下载
    积分:1
  • C# 从RichTextBox 控件中提取文本内容
    C# 从RichTextBox 控件中提取文本内容,并设置RichTextBox 控件中的字体大小-附完整源代码,   private void button1_Click(object sender, RoutedEventArgs e)   {//从RichTextBox 控件中提取文本内容    TextRange MyText = new TextRange(this.richTextBox1.Document.ContentStart, this.richTextBox1.Document.ContentEnd);    MessageBox.Show(MyText.Text, "RichTextBox控件中的文本内容",MessageBoxButton.OK);   }   private void button2_Click(object sender, RoutedEventArgs e)   {//设置RichTextBox 控件中的字体大小    TextRange MyText = new TextRange(this.richTextBox1.Document.ContentStart, this.richTextBox1.Document.ContentEnd);    MyText.ApplyPropertyValue(TextElement.FontSizeProperty, 36.00);    MyText.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);   
    2022-09-21 17:55:02下载
    积分:1
  • C# 执行存储过程的相关例子
    C# 执行存储过程的相关例子,一共演示了执行4种存储过程的方法:   执行NewSelectCommand存储过程   执行NewInsertCommand存储过程   执行NewUpdateCommand存储过程   执行NewDeleteCommand存储过程   源码包中自带有SQLSERVER MDF数据库文件,测试前请附加。
    2022-01-25 20:11:54下载
    积分:1
  • C# 显示DataGridView控件中选定的单元格、行和列
    Visual C#显示选择的DataGridView单元格,获取DataGridView控件中选定的单元格、行和列,测试前请连接好数据库,实现此功能核心代码如下:   if (customersDataGridView.AreAllCellsSelected(true))   {    MessageBox.Show("所有单元格已经被选择!", "信息提示",MessageBoxButtons.OK);   }   else   {    System.Text.StringBuilder MyInfo =new System.Text.StringBuilder();    for (int i = 0;    i < MyCount; i++)    {    MyInfo.Append("行号: ");    MyInfo.Append(customersDataGridView.SelectedCells[i].RowIndex.ToString());    MyInfo.Append(", 列号: ");    MyInfo.Append(customersDataGridView.SelectedCells[i].ColumnIndex.ToString());    MyInfo.Append(", 单元格值: ");    MyInfo.Append(customersDataGridView.SelectedCells[i].Value.ToString());    MyInfo.Append(Environment.NewLine);    }    MyInfo.Append("一共选择了: " + MyCount.ToString()+"个单元格");    MessageBox.Show(MyInfo.ToString(), "信息提示", MessageBoxButtons.OK);   }
    2022-03-18 13:11:05下载
    积分:1
  • C# 查询订购产品ID为51的客户信息
    C# 查询订购产品ID为51的客户信息,需要连接数据库来测试,相关代码分享如下:   //查询订购产品ID为51的客户信息   SqlConnection MyConnection = new SqlConnection(@"Data Source =luobin-PCSQLEXPRESS;Initial Catalog=Northwind;Integrated Security=True");   MyConnection.Open();   DataSet MyDataSet = new DataSet("CustomerOrdersDetails");   SqlDataAdapter MyCustomerAdapter = new SqlDataAdapter("SELECT * FROM Customers", MyConnection);   MyCustomerAdapter.Fill(MyDataSet, "Customers");   DataTable MyTable = new DataTable();   MyCustomerAdapter.Fill(MyTable);   SqlDataAdapter MyOrderAdapter = new SqlDataAdapter("SELECT * FROM Orders", MyConnection);   MyOrderAdapter.Fill(MyDataSet, "Orders");   SqlDataAdapter MyDetailAdapter = new SqlDataAdapter("SELECT * FROM [Order Details]", MyConnection);   MyDetailAdapter.Fill(MyDataSet, "OrderDetails");   MyConnection.Close();   MyDataSet.Relations.Add("CustOrders",MyDataSet.Tables["Customers"].Columns["CustomerID"],MyDataSet.Tables["Orders"].Columns["CustomerID"]).Nested = true;   MyDataSet.Relations.Add(
    2023-04-28 12:35:03下载
    积分:1
  • C#结合数据库使用二进制存取用户头像图片
    C#结合数据库使用二进制存取用户头像图片,这个例子的功能主是把图片数据以二进制格式存储在数据库中,这样可方便数据的移植,不过图像比较占空间,会导致数据库文件会大不少。这个例子以存储用户的头像图片为例,演示如何将图片转换为二进制数据并存储在数据库中。本实例还演示了从数据库中读取数据,然后在DataGridView中显示用户名称,使用数据库中存储的二进制头像实例化内存数据流。
    2022-03-21 01:19:34下载
    积分:1
  • 696516资源总数
  • 106409会员总数
  • 8今日下载