我正在尝试使用Mono加载位图并在Linux上打印它,但出现异常. Mono支持在Linux上打印吗?代码/异常如下:
编辑:不再得到例外,但我仍然很好奇有什么样的支持.留下后代代码.
private void btnPrintTest_Click(object sender, EventArgs e)
{
_printDocTest.DefaultPageSettings.Landscape = true;
_printDocTest.DefaultPageSettings.Margins = new Margins(50,50,50,50);
_printDocTest.Print();
}
void _printDocTest_PrintPage(object sender, PrintPageEventArgs e)
{
var bmp = new Bitmap("test.bmp");
// Determine center of graph
var xCenter = e.MarginBounds.X + (e.MarginBounds.Width - bmp.Width) / 2;
var yCenter = e.MarginBounds.Y + (e.MarginBounds.Height - bmp.Height) / 2;
e.Graphics.DrawImage(bmp, xCenter, yCenter);
e.HasMorePages = false;
}
最佳答案
从Mono docs开始,我认为是:
Managed.Windows.Forms (aka
System.Windows.Forms): A complete and
cross platform, System.Drawing based
Winforms implementation.
如果首先运行Mono Migration Analyzer,它也很有用.
相关文章
转载注明原文:c#-Mono支持System.Drawing和System.Drawing.Printing吗? - 代码日志