工具箱–右键–选择项–COM组件–Adobe PDF Reader;在Resources中添加了pdf资源文件
程序编码为:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace _5_pdf_
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void axAcroPDF1_OnError(object sender, EventArgs e)
{
程序编码为:using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace _5_pdf_
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void axAcroPDF1_OnError(object sender, EventArgs e)
{
File.WriteAllBytes(“微生物与行为和精神疾病_梁姗.pdf”, (byte[])Properties.Resources.ResourceManager.GetObject(“微生物与行为和精神疾病_梁姗.pdf”));
axAcroPDF1.src = “微生物与行为和精神疾病_梁姗.pdf”;
}
}
}
求指导释哪儿出错了?
解决方案
40
应该出错在 File.WriteAllBytes这一行。记得PDF不能这样。要用他的COM控件去