windowsform C#中的Axacropdf acrobat reader COM组件 [英] Axacropdf acrobat reader COM component in windowsform C#

查看:210
本文介绍了windowsform C#中的Axacropdf acrobat reader COM组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在表格中使用Acrobat ReaderCOM组件,用于显示PDF组件。

当表格关闭时,抛出访问冲突异常。



//在Form.Designer.cs中自动生成代码

Hi,
i'm using the "Acrobat Reader" COM-Component in a Form, for displaying PDF-Components.
When the Form is closed, an Access Violation Exception is thrown.

// Auto generated Code in Form.Designer.cs

/// <summary>
     /// Clean up any resources being used.
     /// </summary>
     /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
     protected override void Dispose(bool disposing)
     {
         if (disposing && (components != null))
         {
             components.Dispose();
         }
         base.Dispose(disposing); // here the Exception is thrown
     }





我尝试过:



我试过:



1.从this.components组件中删除组件.//相同结果

2.加载不存在的文档,清除组件。 //相同结果

3. Marshal.ReleaseComObject(axAcroPDF1); //异常不是COM-Object



What I have tried:

I Tried:

1. Removing the Component from the this.components Collection of the Form.// Same Result
2. Loading an not existing Document, to clear the Component. // Same Result
3. Marshal.ReleaseComObject(axAcroPDF1); // Exception Not a COM-Object

推荐答案

base.Dispose(disposing);// Here the Exception is thrown





您已处置(非托管)组件(component.Dispose()),现在正试图处置实时托管表单本身...从它的外观。不合逻辑。



You've "disposed" of the (unmanaged) "component" (component.Dispose()), and are now attempting to dispose the live managed form itself ... from the looks of it. Not logical.


这篇关于windowsform C#中的Axacropdf acrobat reader COM组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆