private void HandlePrintDocumentPrintPage(object sender, PrintPageEventArgs e) { if (_targetCanvas == null) { return; } var g = e.Graphics; g.SmoothingMode = SmoothingMode.HighQuality; g.TextRenderingHint = TextRenderingHint.AntiAlias; g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.CompositingQuality = CompositingQuality.HighQuality; g.PixelOffsetMode = PixelOffsetMode.Default; var pages = _targetCanvas.CalcPrintPages(g, e.MarginBounds, 30, FitKind); if (_currentPrintPage < pages) { _targetCanvas.PrintPages(g, e.MarginBounds, _currentPrintPage, 30, FitKind); ++_currentPrintPage; if (_currentPrintPage < pages) { e.HasMorePages = true; } else { e.HasMorePages = false; /// これがないとPrintPreviewDialogの印刷ボタンを押されたときに /// _currentPrintPageがpagesと同じ値になって白紙が印刷される _currentPrintPage = 0; } } }