单是否支持System.Drawing中和System.Drawing.Printing? [英] Does Mono support System.Drawing and System.Drawing.Printing?
问题描述
我试图用单声道加载一个位图,并打印在Linux上,但我发现一个例外。单是否支持打印在Linux上?下面的code /的例外是:
编辑:不再变得异常,但我仍然好奇什么样的支持是有的。离开code留给后人什么的。
私人无效btnPrintTest_Click(对象发件人,EventArgs的)
{
_printDocTest.DefaultPageSettings.Landscape = TRUE;
_printDocTest.DefaultPageSettings.Margins =新的页边距(50,50,50,50);
_printDocTest.Print();
}
无效_printDocTest_PrintPage(对象发件人,PrintPageEventArgs E)
{
VAR BMP =新位图(test.bmp);
//确定图形的中心
变种X中心值= e.MarginBounds.X +(e.MarginBounds.Width - bmp.Width)/ 2;
变种yCenter = e.MarginBounds.Y +(e.MarginBounds.Height - bmp.Height)/ 2;
e.Graphics.DrawImage(BMP,X中心值,yCenter);
e.HasMorePages = FALSE;
}
从黑白文档,我觉得是:
Managed.Windows.Forms(又名 System.Windows.Forms的):一个完整的, 跨平台,基于System.Drawing中 的WinForms实现。
这也是有用的,如果你运行单迁移分析器第一。
I'm attempting to use Mono to load a bitmap and print it on Linux but I'm getting an exception. Does Mono support printing on Linux? The code/exception are below:
EDIT: No longer getting the exception, but I'm still curious what kind of support there is. Leaving the code for posterity or something.
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;
}
From the Mono docs, I think yes:
Managed.Windows.Forms (aka System.Windows.Forms): A complete and cross platform, System.Drawing based Winforms implementation.
It also useful if you run the Mono Migration Analyzer first.
这篇关于单是否支持System.Drawing中和System.Drawing.Printing?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!