【问题标题】:Does Mono support System.Drawing and System.Drawing.Printing? [closed]Mono 是否支持 System.Drawing 和 System.Drawing.Printing? [关闭]
【发布时间】:2010-09-06 20:20:28
【问题描述】:

我正在尝试使用 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;
}

【问题讨论】:

  • 哦..oops,看起来我只是指定了错误的文件路径(将其更改为先打开文件然后将其加载到位图中)。现在开始工作了——这里没什么可看的,继续前进。

标签: c# .net linux printing mono


【解决方案1】:

来自Mono docs,我认为是的:

Managed.Windows.Forms(又名 System.Windows.Forms):一个完整​​且 跨平台,基于 System.Drawing Winforms 实现。

如果您先运行Mono Migration Analyzer,它也很有用。

【讨论】:

    【解决方案2】:

    According to

    System.Drawing 现已完成,除了作为 Windows.Forms 的底层渲染引擎外,它还经过测试,可以使用严重依赖它的第三方控件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多