Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/283.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# Mono是否支持System.Drawing和System.Drawing.Printing?_C#_.net_Linux_Printing_Mono - Fatal编程技术网

C# Mono是否支持System.Drawing和System.Drawing.Printing?

C# Mono是否支持System.Drawing和System.Drawing.Printing?,c#,.net,linux,printing,mono,C#,.net,Linux,Printing,Mono,我试图使用Mono加载位图并在Linux上打印,但遇到了一个异常。Mono支持在Linux上打印吗?代码/例外情况如下: 编辑:不再获得异常,但我仍然好奇有什么样的支持。把代码留给后代或其他什么 private void btnPrintTest_Click(object sender, EventArgs e) { _printDocTest.DefaultPageSettings.Landscape = true; _printDocTest.DefaultPageSetti

我试图使用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;
}
从这个角度来看,我认为是的:

Managed.Windows.Forms(又名 System.Windows.Forms):一个完整的 基于图形的跨平台、系统 Winforms实现

如果运行第一个,它也很有用。


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

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