Archived

This topic is now archived and is closed to further replies.

can not destinguish between components that are Containers and normal comp.....

This topic is 5587 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

What am I doing is a sort of designer, you know, I have a canvas (Form, Container) and I am doing transactions (Sizing, Positioning, ... etc) of components on the form. Well if the component is in the form there is no problem, beacuse I make an HitTest to see which component I hit and then I do the thansaction on component. Well the problem is that I can not destinguish between components that are Containers (have an IContainer interface implemented) like GroupBox or TabPane or ordanary Pane and normal components that do not act like Containers. Do you know how is this implemented in .NET Framework??? (note: visual C++ .Net) [edited by - kirik88 on August 28, 2002 4:41:00 PM] [edited by - kirik88 on August 28, 2002 4:48:31 PM]

Share this post


Link to post
Share on other sites
Yes that was the first if check on my mind. The problem is, that it doesn''t work. Every control returns false. Example in C#:

Component to_check = ...;

if ((Object)to_check is IContainer)
{
Console.Wreiteline("Component : " + to_check + " is container");
}

I''we been digging in .NET objects and found out that there is something called ControlStyle enumeration. And a flag in that enumeration is set when a component behaves like a container (BTW. even buttton can be a container). But the testing of Style (GetStyle() function) is a protected method and I can not (well not acctualy true. with reflection i can do that BUT I don''t wanna call it outside of Control or derived objects.

Do you maybe now? Is there some static method like Control.MousePosition, which returns Style of Control????

Share this post


Link to post
Share on other sites