Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/336.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
VC#2010Express打印打开文件_C# - Fatal编程技术网

VC#2010Express打印打开文件

VC#2010Express打印打开文件,c#,C#,我是新来的,我的英语不是最好的,但我有一个问题。 在VC#2010 Express中是否有可能打印我通过openFileDialog打开的文件? 打开的文件在webBrowser元素中可见,也可以编辑,但现在,每次我尝试“启动”/“调试”应用程序时,都会显示一条错误消息。 错误消息: "System.IO.StreamReader" does not contain a constructor that takes 0 arguments. 这是我需要为要打印的文件指定文件路径的行 我应该在括

我是新来的,我的英语不是最好的,但我有一个问题。 在VC#2010 Express中是否有可能打印我通过openFileDialog打开的文件? 打开的文件在webBrowser元素中可见,也可以编辑,但现在,每次我尝试“启动”/“调试”应用程序时,都会显示一条错误消息。 错误消息:

"System.IO.StreamReader" does not contain a constructor that takes 0 arguments.
这是我需要为要打印的文件指定文件路径的行


我应该在括号中输入什么来对webBrowser元素中的文件进行分类?

您需要粘贴代码,以便我们可以帮助您阅读有关streamreader的内容:
System.IO.StreamReader fileToPrint;
System.Drawing.Font printFont;
private void printButton_Click(object sender, EventArgs e)
{
  string printPath = System.Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
  fileToPrint = new System.IO.StreamReader(printPath + @"\myFile.txt");
  printFont = new System.Drawing.Font("Arial", 10);
  printDocument1.Print();
  fileToPrint.Close();
}