Technically, that property returns the state of that component/control. In
the case of controls on a usercontrol they are in runmode since there is no
designer/site associated with the controls. If you really need to know if
any control in the parent chain is in design mode, you can walk up the
parent chain, checking to see if the Site is non-null and if so, checking
the designmode property of the site.
e.g.
public static bool IsDesignMode(Control control)
{
if (control == null)
return false;
if (control.Site != null && control.Site.DesignMode)
return true;
return IsDesignMode(control.Parent);
}
> The problem is that DesignMode property only returns True, if the control
> can be directly modified.
[quoted text clipped - 8 lines]
> Is there any way to get this information, since DesignMode property is kind
> of inaccurate?
Marina - 11 Jun 2004 15:50 GMT
Ok, thanks, I might try that.
It's too bad there is no general property that just tells the developer if
the application is currently being work on in the IDE, or if it is actually
running. That seems a lot more useful then to know if the current component
can be designed.
Thanks.
"Andrew Smith (Infragistics)" <productmanager@infragistics.com> wrote in
message news:ey18ykOTEHA.1508@TK2MSFTNGP11.phx.gbl...
> Technically, that property returns the state of that component/control. In
> the case of controls on a usercontrol they are in runmode since there is no
[quoted text clipped - 27 lines]
> kind
> > of inaccurate?
Grant Frisken - 13 Jun 2004 07:52 GMT
You can do this by checking the value of
Reflection.Assembly.GetEntryAssembly. If this is null then you are most
likely running from the IDE. This is a bit of a hack and assumes your
runtime entry executable is a managed assembly - but it will probably
achieve what you want.
Regards
Grant
> Ok, thanks, I might try that.
>
[quoted text clipped - 41 lines]
> > kind
> > > of inaccurate?