Does Mono support System.Drawing and System.Drawing.Printing?(Mono 是否支持 System.Drawing 和 System.Drawing.Printing?)
问题描述
我正在尝试使用 Mono 加载位图并在 Linux 上打印它,但我遇到了异常.Mono 是否支持在 Linux 上打印?代码/异常如下:
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:
不再出现异常,但我仍然很好奇有什么样的支持.留下代码供后代使用.
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;
}
推荐答案
来自 Mono 文档,我认为是的:
Managed.Windows.Forms(又名System.Windows.Forms):一个完整且跨平台,基于 System.DrawingWinforms 实现.
Managed.Windows.Forms (aka System.Windows.Forms): A complete and cross platform, System.Drawing based Winforms implementation.
如果您先运行 Mono 迁移分析器,它也很有用.
It also useful if you run the Mono Migration Analyzer first.
这篇关于Mono 是否支持 System.Drawing 和 System.Drawing.Printing?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Mono 是否支持 System.Drawing 和 System.Drawing.Printing?


- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- C# 中多线程网络服务器的模式 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 输入按键事件处理程序 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01