Check the the property Form.DesignMode.
But, note that when in Visual Inheritance mode (designing a derived form), your Control’s DesignMode property will be true when the base form’s constructor gets executed in the design-time.
To workaround this, you could check if the app in which your control is running is not devenv.exe, as follows:
string exePath = Application.ExecutablePath;
exePath = exePath.ToLower();
if(Application.ExecutablePath.ToLower().IndexOf('devenv.exe') > -1)
{
// Then you are running in vs.net.
}
Share with