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?
基础教程推荐
- SonarQube C# 分析失败“不是指针的有效行偏移" 2022-01-01
- 重新排序 WPF TabControl 中的选项卡 2022-01-01
- 更新 Visual Studio 中的 DataSet 结构以匹配新的 SQL 数据库结构 2022-01-01
- Mono https webrequest 失败并显示“身份验证或解密失败" 2022-01-01
- 在 VB6 或经典 ASP 中使用 .NET 2022-01-01
- 从 C# 控制相机设备 2022-01-01
- 如果条件可以为空 2022-01-01
- 获取C#保存对话框的文件路径 2022-01-01
- C# 9 新特性——record的相关总结 2023-04-03
- 将数据集转换为列表 2022-01-01
