【发布时间】:2013-05-11 01:31:56
【问题描述】:
我有一个带有Visio Drawing Control 的表单。我正在使用Visio Drawing Control 11.0(我的 PC 上安装了 Visio 2003)。在表单加载事件中,我执行以下操作:
private void Form1_Load(object sender, EventArgs e)
{
this.axDrawingControl1.Src = @"D:\visio test\drawing.vsd";
Document currentStencil = this.axDrawingControl1.Document.Application.Documents.OpenEx(@"Basic_U.vss", (short)VisOpenSaveArgs.visOpenDocked);
Window stencilWindow = this.axDrawingControl1.Document.OpenStencilWindow();
}
当我运行应用程序时,我向文档添加了一个形状,然后应用程序崩溃并显示 AccessViolationException. 错误消息显示 Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
但是,当我通过将DrawingControl.Src 属性设置为文档的文件名来不打开文档时,应用程序工作正常,但我需要打开文档并使用编辑它绘图控件。
有没有办法解决这个问题?
【问题讨论】:
标签: c# com access-violation visio