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 调用后添加任何构造函数代码
                
    //
            }

    效果如下:
  • 相关阅读:
    项目管理软件选择:redmine or JIRA
    为已编译的DLL附带强命名
    NET简单的一个画图程序
    公共的Json操作类
    ASP.NET 程序优化
    提高ASP.NET页面载入速度的方法
    DataTable快速定制之Expression属性表达式
    TCP和UDP Client 代码
    Jquery实现异步上传图片
    C语言Socket编程(计算机网络作业)
  • 原文地址:https://www.cnblogs.com/xiaotaoliang/p/385951.html
Copyright © 2011-2022 走看看