首先需要引用Adobe Acrobat 7.0 Browser Control控件。工具箱,添加选择项
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string filename = MyOpenFileDialog();
axAcroPDF1.LoadFile(filename);
}
string MyOpenFileDialog()
{
OpenFileDialog ofd = new OpenFileDialog(); ofd.Filter = "PDF文档(*.pdf)|*.pdf";
if (ofd.ShowDialog() == DialogResult.OK) { return ofd.FileName; } else { return null; }
}
private void Form1_Load(object sender, EventArgs e)
{
}
}
}
本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。