Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detecting design mode from a Control's constructor

Tags:

c#

winforms

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.

like image 306
nwahmaet Avatar asked Jul 22 '09 15:07

nwahmaet


1 Answers

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

bool designMode = (LicenseManager.UsageMode == LicenseUsageMode.Designtime);
like image 190
adrianbanks Avatar answered Oct 21 '22 04:10

adrianbanks