C#基本打印事件用法實例
更新時間:2015年06月13日 09:17:13 作者:zhuzhao
這篇文章主要介紹了C#基本打印事件用法,實例分析了C#中print打印及DrawString文本字符串繪制等相關(guān)技巧,需要的朋友可以參考下
本文實例講述了C#基本打印事件用法。分享給大家供大家參考。具體如下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace WindowsApplication3 { public partial class Form5 : Form { string filename = "myfile.txt"; Font printerfont = null; public Form5() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { this.printDocument1.DocumentName = this.filename; this.printDocument1.Print(); } private void printDocument1_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e) { printerfont = new Font("Lucida Console", 72); } private void printDocument1_EndPrint(object sender, System.Drawing.Printing.PrintEventArgs e) { printerfont.Dispose(); printerfont = null; } private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Graphics g = e.Graphics; g.DrawString("hello,/nPrinter", printerfont, Brushes.Black, 0, 0); } } }
希望本文所述對大家的C#程序設(shè)計有所幫助。
相關(guān)文章
C# List<T> Contains<T>()的用法小結(jié)
本篇文章主要是對C#中List<T> Contains<T>()的用法進(jìn)行了總結(jié)介紹,需要的朋友可以過來參考下,希望對大家有所幫助2014-01-01C#利用FileSystemWatcher實時監(jiān)控文件的增加,修改,重命名和刪除
好多時候,我們都需要知道某些目錄下的文件什么時候被修改、刪除過等。本文將利用FileSystemWatcher實現(xiàn)實時監(jiān)控文件的增加,修改,重命名和刪除,感興趣的可以了解一下2022-08-08C#中Winform窗體Form的關(guān)閉按鈕變灰色的方法
這篇文章主要介紹了C#中Winform窗體Form的關(guān)閉按鈕變灰色的方法,對于C#程序界面的設(shè)計有一定的借鑒價值,需要的朋友可以參考下2014-08-08C# WebApi+Webrtc局域網(wǎng)音視頻通話實例
這篇文章主要為大家詳細(xì)介紹了C# WebApi+Webrtc局域網(wǎng)音視頻通話實例,文中示例代碼介紹的非常詳細(xì),具有一定的參考價值,感興趣的小伙伴們可以參考一下2021-07-07基于C#實現(xiàn)自定義計算的Excel數(shù)據(jù)透視表
數(shù)據(jù)透視表(Pivot?Table)是一種數(shù)據(jù)分析工具,通常用于對大量數(shù)據(jù)進(jìn)行匯總、分析和展示,本文主要介紹了C#實現(xiàn)自定義計算的Excel數(shù)據(jù)透視表的相關(guān)知識,感興趣的可以了解下2023-12-12