C#基本打印事件用法實(shí)例
本文實(shí)例講述了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); } } }
希望本文所述對(duì)大家的C#程序設(shè)計(jì)有所幫助。
相關(guān)文章
C#訪問(wèn)PostGreSQL數(shù)據(jù)庫(kù)的方法
這次的項(xiàng)目中的一個(gè)環(huán)節(jié)要求我把PostGreSQL數(shù)據(jù)取出來(lái),然后放到SqlServer里,再去處理分析。2013-04-04C# List<T> Contains<T>()的用法小結(jié)
本篇文章主要是對(duì)C#中List<T> Contains<T>()的用法進(jìn)行了總結(jié)介紹,需要的朋友可以過(guò)來(lái)參考下,希望對(duì)大家有所幫助2014-01-01C#利用FileSystemWatcher實(shí)時(shí)監(jiān)控文件的增加,修改,重命名和刪除
好多時(shí)候,我們都需要知道某些目錄下的文件什么時(shí)候被修改、刪除過(guò)等。本文將利用FileSystemWatcher實(shí)現(xiàn)實(shí)時(shí)監(jiān)控文件的增加,修改,重命名和刪除,感興趣的可以了解一下2022-08-08C#中Winform窗體Form的關(guān)閉按鈕變灰色的方法
這篇文章主要介紹了C#中Winform窗體Form的關(guān)閉按鈕變灰色的方法,對(duì)于C#程序界面的設(shè)計(jì)有一定的借鑒價(jià)值,需要的朋友可以參考下2014-08-08C# WebApi+Webrtc局域網(wǎng)音視頻通話實(shí)例
這篇文章主要為大家詳細(xì)介紹了C# WebApi+Webrtc局域網(wǎng)音視頻通話實(shí)例,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2021-07-07基于C#實(shí)現(xiàn)自定義計(jì)算的Excel數(shù)據(jù)透視表
數(shù)據(jù)透視表(Pivot?Table)是一種數(shù)據(jù)分析工具,通常用于對(duì)大量數(shù)據(jù)進(jìn)行匯總、分析和展示,本文主要介紹了C#實(shí)現(xiàn)自定義計(jì)算的Excel數(shù)據(jù)透視表的相關(guān)知識(shí),感興趣的可以了解下2023-12-12