从控制的构造设计检测模式 [英] Detecting design mode from a Control's constructor

查看:100
本文介绍了从控制的构造设计检测模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

继 - 从<一href=\"http://stackoverflow.com/questions/336817/how-can-i-detect-whether-a-user-control-is-running-in-the-ide-in-debug-mode-or\">this问题,它是可以检测一个人是否是在设计还是运行模式从对象的构造函数中?

Following-on from this question, is it possible to detect whether one is in design or runtime mode from within an object's constructor?

我知道这是不可能的,而且我必须改变我想要的东西,但现在我很感兴趣,这个具体的问题。

I realise that this may not be possible, and that I'll have to change what I want, but for now I'm interested in this specific question.

推荐答案

您可以使用LicenceUsageMode枚举在 System.ComponentModel 命名空间:

You can use the LicenceUsageMode enumeration in the System.ComponentModel namespace:

bool designMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime);

这篇关于从控制的构造设计检测模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆