---
title: "C#使用PDF控件打开PDF"
author: "ruohanfly"
date: "2016-01-20T09:42:48Z"
tags: []
categories: ["编程语言"]
slug: "c-pdf-pdf"
draft: false
lastmod: "2016-01-15T16:19:07Z"
id: 2271436
url: "https://ruohanfly.iteye.com/blog/2271436"
---

```
        private void button2_Click(object sender, EventArgs e)
        {
            if (pdfpath.Equals(""))
            {
                MessageBox.Show("请先选择要查看的文件", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            else
            {
                if (File.Exists(pdfpath))
                {
                    axAcroPDF1.LoadFile(pdfpath);
                }
                else
                {
                    MessageBox.Show("文件不存在", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    axAcroPDF1.LoadFile(path+"xls\\404.pdf");
                }
            }
        }
```

 注：安装AdbeRdr11000\_zh\_CN11.0.0.379.1410747856.exe阅读器，并添加引用就可以拖拽控件使用了