mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 11:21:39 -10:00
* Margins.cs: Restyled, implemented missing members * PageSettings.cs: Added missing attributes, stubbed, fixed a few small issues * PreviewPrintController.cs: Stubbed, small issues fixed * PrintController.cs: Marked unfinished, restyled * PrintDocument.cs: Added attributes * PrinterResolution.cs: Added missing method * PrinterSettings.cs: Mono-stylyzed, fixed signatures, removed commented out values * PrinterUnitConvert.cs: Added private constructor * StandardPrintController.cs: Little restyling * PaperKind.cs: Added missing enum values svn path=/trunk/mcs/; revision=22874
71 lines
1.8 KiB
C#
71 lines
1.8 KiB
C#
//
|
|
// System.Drawing.StandardPrintController.cs
|
|
//
|
|
// Author:
|
|
// Dennis Hayes ([email protected])
|
|
// Herve Poussineau ([email protected])
|
|
//
|
|
// (C) 2002 Ximian, Inc
|
|
//
|
|
|
|
using System;
|
|
|
|
namespace System.Drawing.Printing
|
|
{
|
|
public class StandardPrintController : PrintController
|
|
{
|
|
private int page;
|
|
private Image image;
|
|
|
|
public StandardPrintController()
|
|
{
|
|
}
|
|
|
|
[MonoTODO("StandardPrintController.OnEndPage")]
|
|
public override void OnEndPage(PrintDocument document, PrintPageEventArgs e)
|
|
{
|
|
//TODO: print current page
|
|
// - image to print is this.image
|
|
// - page settings are in e.PageSettings
|
|
// - printer settings are in document.PrinterSettings
|
|
// - don't forget to use document.OriginAtMargins (only if .NET 1.1)
|
|
|
|
// actually, "print" == "save to a file"
|
|
try
|
|
{
|
|
string fileName = document.DocumentName + " " + page.ToString("D4") + ".jpg";
|
|
Console.WriteLine("StandardPrintController: Print page \"{0}\"", fileName);
|
|
image.Save(fileName, System.Drawing.Imaging.ImageFormat.Jpeg);
|
|
}
|
|
catch (Exception) {}
|
|
|
|
if (e.Graphics != null)
|
|
e.Graphics.Dispose();
|
|
}
|
|
|
|
[MonoTODO("StandardPrintController.OnStartPrint")]
|
|
public override void OnStartPrint(PrintDocument document, PrintEventArgs e){
|
|
page = 0;
|
|
}
|
|
|
|
[MonoTODO("StandardPrintController.OnEndPrint")]
|
|
public override void OnEndPrint(PrintDocument document, PrintEventArgs e){
|
|
return;
|
|
}
|
|
|
|
[MonoTODO("StandardPrintController.OnStartPage")]
|
|
public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs e)
|
|
{
|
|
//FIXME: I'm not sure of what I'm doing
|
|
// I don't know what size to give to image
|
|
// and why I have to clear it
|
|
page++;
|
|
// returns a new (empty) graphics
|
|
image = new Bitmap(e.MarginBounds.Width, e.MarginBounds.Height);
|
|
Graphics g = Graphics.FromImage(image);
|
|
g.Clear(Color.White);
|
|
return g;
|
|
}
|
|
}
|
|
}
|