Form1の全コード
using System;
using System.Windows.Forms;
using Microsoft.VisualBasic.PowerPacks.Printing;
namespace Print
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Button1_Click(object sender, EventArgs e)
{
if (PrintDialog1.ShowDialog() == DialogResult.OK)
{
printForm1.PrinterSettings = PrintDialog1.PrinterSettings;
printForm1.PrinterSettings.DefaultPageSettings.Margins.Bottom = 10;
printForm1.PrinterSettings.DefaultPageSettings.Margins.Left = 10;
printForm1.PrinterSettings.DefaultPageSettings.Margins.Right = 10;
printForm1.PrinterSettings.DefaultPageSettings.Margins.Top = 10;
printForm1.Print(this,PrintForm.PrintOption.Scrollable);
}
}
}
}