Detect if control is hosted in the Visual Studio designer?
-
I'm creating an animated custom control using System.Windows.Forms.Timer as the animation trigger. I would like to freeze the animation during design time, however, as the animation may disturb the user. Is it possible to detect somehow that that the control is hosted in the Visual Studio designer?
-
I'm creating an animated custom control using System.Windows.Forms.Timer as the animation trigger. I would like to freeze the animation during design time, however, as the animation may disturb the user. Is it possible to detect somehow that that the control is hosted in the Visual Studio designer?
Try checking
if ( !this.DesignMode ) ...
-
Try checking
if ( !this.DesignMode ) ...
I forgot to mention that I'm working with .NET Compact Framework, but your answer helped me enough to find the solution. On Compact Framework I had to check for
this.Site.DesignMode
rather than justthis.DesignMode
. Thanks a lot :)