导航

如何判断VS.NET设计时?

Posted on 2015-01-05 16:32  eastson  阅读(154)  评论(0编辑  收藏  举报

方法一:

if (System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv")
//...Then Continue

方法二:

if(System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime)
//... Then Continue

没有测试过,感觉可行。