zoukankan      html  css  js  c++  java
  • 控件设计时的属性页定位办法

    控件设计时的属性页定位办法:
    取得IHtmlDocument3 就随心所欲了。

    public LabelComponentEditorForm(ComponentEditorLabel designComponent)
            
    {
                
    this.designComponent = designComponent;
                
                
    int innerLeft = Convert.ToInt32(designComponent.Style["clientX"]);
                
    int innerTop = Convert.ToInt32(designComponent.Style["clientY"]);

                IDesignerHost host 
    = (IDesignerHost) designComponent.Site.GetService(typeof (IDesignerHost));
                ControlDesigner labelDesigner 
    = (ControlDesigner) host.GetDesigner(designComponent);
                
    object parent = labelDesigner.Behavior.GetAttribute("document"false);
                IHTMLDocument2 doc 
    = (IHTMLDocument2) parent;
                mshtml.IHTMLWindow3 window 
    = (IHTMLWindow3) doc.parentWindow;
                
    int screenLeft = window.screenLeft;
                
    int screenTop = window.screenTop;
                
                
    this.Location = new Point(screenLeft + innerLeft, screenTop + innerTop);

                
    //
                
    // Windows 窗体设计器支持所必需的
                
    //
                InitializeComponent();

                
    //
                
    // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
                
    //
            }

    效果如下:
  • 相关阅读:
    VIM的强大功能
    BigDecimal.ROUND_HALF_XXX的各种用法
    拒绝服务攻击
    浅谈(接口)测试注意事项四
    jmeter 与 java http
    Xms Xmx PermSize MaxPermSize 区别
    Jquery过滤器
    JQ工具函数运用
    C#扩展方法
    LINQ TO XML基础
  • 原文地址:https://www.cnblogs.com/xiaotaoliang/p/385951.html
Copyright © 2011-2022 走看看