请问大侠们:如何判断一个控件是不是在设计期状态呀?

解决方案 »

  1.   

    Component.DesignMode 属性  [C#]请参见
    Component 类 | Component 成员 | System.ComponentModel 命名空间 | IContainer | Container | ISite | Component 成员(Visual J# 语法) | C++ 托管扩展编程 
    要求
    平台: Windows 98, Windows NT 4.0, Windows ME, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 系列
    语言
    C#C++JScriptVisual Basic全部显示
    获取一个值,用以指示 Component 当前是否处于设计模式。[Visual Basic]
    Protected ReadOnly Property DesignMode As Boolean[C#]
    protected bool DesignMode {get;}[C++]
    protected: __property bool get_DesignMode();[JScript]
    protected function get DesignMode() : Boolean;属性值
    如果 Component 处于设计模式,则为 true;否则为 false。备注
    设计模式指示器存储在 ISite 中;因此,如果 Component 没有与其关联的 ISite,则该属性始终为 false。
      

  2.   

    if(this.DesignMode == false)
    { ……………… }