Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Winforms DesignMode Property是如何工作的?_Winforms - Fatal编程技术网

Winforms DesignMode Property是如何工作的?

Winforms DesignMode Property是如何工作的?,winforms,Winforms,我创建了一个用户控件,当您在设计器中看到它时,它看起来是空的。这对于程序员来说是个问题,因为他们不知道它在哪里。因此,在构造函数中,我添加了这个条件 public MyControl() { InitializeComponent(); if (this.DesignMode == true) this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; } 没有效果。如果我删除该条件,那么在

我创建了一个用户控件,当您在设计器中看到它时,它看起来是空的。这对于程序员来说是个问题,因为他们不知道它在哪里。因此,在构造函数中,我添加了这个条件

public MyControl()
{
    InitializeComponent();

    if (this.DesignMode == true)
        this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
}
没有效果。如果我删除该条件,那么在设计时和ofc运行时边界是可见的,这不是我的意图


我做错了什么?

我也无法使用默认的
设计模式。。所以我在表格上这样做:

protected new bool DesignMode
{
  get 
  { 
     return base.DesignMode || LicenseManager.UsageMode == LicenseUsageMode.Designtime; 
  }
}
这是一种黑客行为,但似乎起到了作用

是的,这里有一个解释: