• VS2005中得到 Web页面 或 窗体的 IDesignerHost


    private IDesignerHost GetDesignerHost(Window window)
           {
               // In most instances, the IDesignerHost can be retrieved
               // directly off of the window object.
               IDesignerHost designerHost = window.Object as IDesignerHost;
               if (designerHost != null)
                   return designerHost;

               // webform designer though, is a special case
               HTMLWindow htmlWindow = window.Object as HTMLWindow;
               if (htmlWindow != null)
               {
                   // make sure current tab is the designer tab
                   htmlWindow.CurrentTab = vsHTMLTabs.vsHTMLTabsDesign ;
                   IOleServiceProvider oleSP = (IOleServiceProvider)htmlWindow.CurrentTabObject;
                   Microsoft.VisualWebDeveloper.Interop.WebDeveloperPage.DispDesignerDocument d = htmlWindow.CurrentTabObject as Microsoft.VisualWebDeveloper.Interop.WebDeveloperPage.DispDesignerDocument;
                   Guid guidVsMDDDesigner = new Guid("7494682A-37A0-11d2-A273-00C04F8EF4FF");
                   IntPtr ptr;
                   oleSP.QueryService(ref guidVsMDDDesigner, ref guidVsMDDDesigner, out ptr);
                   if (ptr != IntPtr.Zero)
                   {
                       IServiceProvider dotnetSP = (IServiceProvider)Marshal.GetObjectForIUnknown(ptr);
                       Marshal.Release(ptr);
                       designerHost = (IDesignerHost)dotnetSP.GetService(typeof(IDesignerHost));
                   }
               }
               return designerHost;
           }

  • 相关阅读:
    axios的全局配置
    Vue:vue-router编程式导航
    【spring源码系列】之【Bean的属性赋值】
    【spring源码系列】之【Bean的实例化】
    【spring源码系列】之【Bean的生命周期】
    【spring源码系列】之【BeanDefinition】
    【spring源码系列】之【xml解析】
    【spring源码系列】之【环境搭建】
    mysql去重
    Nacos 服务推送和发现
  • 原文地址:https://www.cnblogs.com/MysticBoy/p/1507877.html
Copyright © 2020-2023  润新知