Detecting design mode from a Control's constructor

c#, winforms

Solution

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

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

Problem

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.

Original source

Related problems