![]() |
【解答】:
不要再构造器里面进行判断,构造器里可以使用下面的方法 System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv" 判断
the DesignMode property should not be checked from within the constructor or from any code that the constructor calls. A constructor is called before a control is sited, and it's the site that determines whether or not a control is in design mode. DesignMode will also be false in the constructor.