logo

DesignMode 谁使用成功过?始终是false...头真大

作者:【孟子E章】 阅读:2204 发表于:2008-10-28 00:00:00

【解答】:

不要再构造器里面进行判断,构造器里可以使用下面的方法 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.