all groups > dotnet windows forms > april 2007 >
You're in the

dotnet windows forms

group:

Detecting a tray control


Detecting a tray control Larry Smith
4/20/2007 12:52:02 PM
dotnet windows forms:
Hi there,

I need to determine if an arbitrary control appears on a form's design tray
or the actual form itself (or other parent container). Is the following
check reliable or is there an official way (or something cleaner). Thanks.

public static bool IsTrayControl(Control control)
{
return (TypeDescriptor.GetProperties(control)["TrayLocation"] != null);
}

Re: Detecting a tray control Mattias Sjögren
4/20/2007 9:21:21 PM
[quoted text, click to view]

Don't all controls show up on the Form? I thought only things derived
from Component but not from Control end up in the tray area.


Mattias

--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
AddThis Social Bookmark Button