现在在看visio 2007 SDK的一些例子,其中一个例子officePlan,用自带的代码编译后成功后,画了一个图保存后,然后再打开,居然提示出错。

解决方案 »

  1.   

    目前还没搞懂怎么把visio的组件放到form上。哎
      

  2.   

    在drawingControl.Src = fileName;这里提示错误未处理 System.AccessViolationException
      Message="尝试读取或写入受保护的内存。这通常指示其他内存已损坏。"
      Source="Microsoft.Office.Interop.VisOcx"
      StackTrace:
           在 Microsoft.Office.Interop.VisOcx.DrawingControlClass.set_Src(String pVal)
           在 AxMicrosoft.Office.Interop.VisOcx.AxDrawingControl.set_Src(String value)
           在 Microsoft.Samples.Visio.OfficePlan.CSharp.OfficePlanSampleForm.onMenuFileOpenClicked(Object sender, EventArgs e) 位置 C:\Program Files\Microsoft Office\Office12\VisSDK\Samples\Office Plan\CSharp\frmOfficePlanSample.cs:行号 1007
           在 System.Windows.Forms.MenuItem.OnClick(EventArgs e)
           在 System.Windows.Forms.MenuItem.MenuItemData.Execute()
           在 System.Windows.Forms.Command.Invoke()
           在 System.Windows.Forms.Command.DispatchID(Int32 id)
           在 System.Windows.Forms.Control.WmCommand(Message& m)
           在 System.Windows.Forms.Control.WndProc(Message& m)
           在 System.Windows.Forms.ScrollableControl.WndProc(Message& m)
           在 System.Windows.Forms.ContainerControl.WndProc(Message& m)
           在 System.Windows.Forms.Form.WndProc(Message& m)
           在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           在 System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
           在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           在 System.Windows.Forms.Application.Run(Form mainForm)
           在 Microsoft.Samples.Visio.OfficePlan.CSharp.OfficePlanSampleForm.Main() 位置 C:\Program Files\Microsoft Office\Office12\VisSDK\Samples\Office Plan\CSharp\frmOfficePlanSample.cs:行号 202
           在 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
           在 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
           在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
           在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
           在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
           在 System.Threading.ThreadHelper.ThreadStart()
      InnerException: 
      

  3.   

    重复注册事件会出错的
    请参考下我的软件,配电网络可视化管理系统
    http://www.iqidi.com
      

  4.   

    这个例子没问题,呵呵,有需要做VISIO二次开发的加我QQ:67132140一起解决难题