日期:2014-05-17  浏览次数:21163 次

c# addin开发,高手进。谢谢! 帮顶给分!
各位,利用EnvDTE80.Windows2接口的CreateToolWindow2方法创建的窗口,如何销毁?

附部分代码:
EnvDTE.Window m_toolWindow1 = windows2.CreateToolWindow2(
  _addIn, Assembly.GetExecutingAssembly().Location, fullname, caption, "{903544A1-9DF4-425e-8B20-A47DD705DA7C}", ref obj);

  m_toolWindow1.Linkable = false;
  m_toolWindow1.IsFloating = false;
  m_toolWindow1.Visible = true;

通过m_toolWindow1的关闭按钮关闭窗口,然后再执行如下代码:
 foreach (EnvDTE.Window win in _ApplicationObject.Windows) {
  this._OutputWindowPane.OutputString(string.Format("{0}—{1}",win.Caption,win.Visible)+ Environment.NewLine);
  }

发现m_toolWindow1 仍旧存在,只是Visible = false了。



另:我通过在OnConnect方法中截获WindowEvents,但是我发现以上m_toolWindow1 窗口并未触发
winEvents.WindowActivated += new _dispWindowEvents_WindowActivatedEventHandler(this.WindowActivated);
winEvents.WindowClosing += new _dispWindowEvents_WindowClosingEventHandler(this.WindowClosing);
winEvents.WindowCreated += new _dispWindowEvents_WindowCreatedEventHandler(this.WindowCreated);
winEvents.WindowMoved += new _dispWindowEvents_WindowMovedEventHandler(this.WindowMoved);

几个事件。

请各位帮忙,在线等!

------解决方案--------------------
m_toolWindow1 能否Dispose?
------解决方案--------------------
窗体很久没做了,帮顶了
------解决方案--------------------
探讨
窗体很久没做了,帮顶了