VB.NET, C#, PowerShellを使用しているエンジニアのためのサイト。
基本的な使用方法から開発で役立つTipsまで幅広く取り扱っています。
文字列を印刷するには、引数PrintPageEventArgsオブジェクトのGraphicsプロパティに格納されている、 DrawStringメソッドを使用します。
private void button1_Click(object sender, System.EventArgs e) { //印刷を実行 printDocument1.Print(); } private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Graphics g = e.Graphics; //文字列を描く g.DrawString("文字列を印刷します。", new Font("MS Pゴシック", 12), Brushes.Black, e.MarginBounds.Left, e.MarginBounds.Top); //このページで終了 e.HasMorePages = false; }