如何从AxAcroPDF对象中清除文件 [英] How do I clear the file from the AxAcroPDF object

查看:149
本文介绍了如何从AxAcroPDF对象中清除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示文件的列表框。当您单击列表框中的文件时,它将显示为AxAcroPDF对象。



我遇到的问题是当我选择文件并按下删除时按钮,文件被删除,但pdf仍显示在屏幕上。



如何从AxAcroPDF对象中清除文件?

I have a list box that display files. When you click on the file in the list box, it is displayed as a AxAcroPDF object.

The problem I have is that when I select the file and press my delete button, the file is deleted but the pdf is still displayed on the screen.

How do I clear the file from the AxAcroPDF object?

推荐答案

嗨。



我在尝试清除AxAcroPDF对象时遇到同样的问题。



我解决了它处理和重新创建对象,并再次设置属性(大小,位置等),如下所示:



AxAcroPDFobject .Dispose();

AxAcroPDFobject = new AxAcroPDFLib.AxAcroPDF

{

Enabled = true,

Location =新的System.Drawing.Point( 5 132 ),

Name =AxAcroPDFobject,

Size =新的System.Drawing.Size( 192 242 ),

};

容器 .Controls.Add(AxAcroPDFobject) ;



*您需要更新大小和位置坐标(粗体数字)。

* 容器是包含AxAcroPDF对象的表单或组合框。



注意:此代码适用于C#。我希望这对你有帮助。
Hi.

I experienced the same problem trying to clear AxAcroPDF object.

I solved it disposing and re-creating the object, and setting the properties again (size, position, etc.), as follows:

AxAcroPDFobject.Dispose();
AxAcroPDFobject = new AxAcroPDFLib.AxAcroPDF
{
Enabled = true,
Location = new System.Drawing.Point(5, 132),
Name = "AxAcroPDFobject",
Size = new System.Drawing.Size(192, 242),
};
container.Controls.Add(AxAcroPDFobject);

* You need to update the size and location coordinates (numbers in bold).
* "container" is the form or groupbox containing the AxAcroPDF object.

Note: this code is for C#. I hope this help you.


你需要做的就是加载一个不存在的pdf。我通过错误输入我的pdf文件名错误地发现了这一点。



AxAcroPDFobject.LoadFile(DONTEXISTS.pdf)



这将使pdf查看器返回空白状态。
All you need to do is load a pdf that does not exists. I found this out by mistake by mistyping my pdf file name.

AxAcroPDFobject.LoadFile("DONTEXISTS.pdf")

This will return the pdf viewer to blank status.


我在互联网上搜索了一个答案但尚未找到答案。我做了一个工作。我创建了一个空白文件,并在我完成当前文档时加载它。
I've searched the Internet for an answer & haven't found one. I made a work around. I created a blank file & load it when I'm finished with the current document.


这篇关于如何从AxAcroPDF对象中清除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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