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?
基础教程推荐
- 将 Office 安装到 Windows 容器 (servercore:ltsc2019) 失败,错误代码为 17002 2022-01-01
- SSE 浮点算术是否可重现? 2022-01-01
- c# Math.Sqrt 实现 2022-01-01
- rabbitmq 的 REST API 2022-01-01
- 为什么Flurl.Http DownloadFileAsync/Http客户端GetAsync需要 2022-09-30
- 将 XML 转换为通用列表 2022-01-01
- 有没有办法忽略 2GB 文件上传的 maxRequestLength 限制? 2022-01-01
- 如何激活MC67中的红灯 2022-01-01
- MS Visual Studio .NET 的替代品 2022-01-01
- 如何在 IDE 中获取 Xamarin Studio C# 输出? 2022-01-01