ContainerControl inside another ContainerControl  
Author Message
sohaibi





PostPosted: Windows Forms Designer, ContainerControl inside another ContainerControl Top


<.NETFramework>

I am facing problems using a ContainerControl inside another ContainerControl. The child ContainerControl is not getting on the design surface probably. I'm not being able to drop any control (e.g a Button) on the inner ContainerControl. It is dropping the control (Button) on the outer ContainerControl instead. I know there is something like EnableDesignMode in Framewrok 2.0. But I cannot find it in Framewrok 1.1.

I would also like to share that I'm working on a TableControl that will be just like an HTML Table Control. I also know that Microsoft has provided a TableLayoutPanel with Framework 2.0. But due to some requirements I cannot go for it. Currently I'm trying to design something like this:

<Table type="ContainerControl">
<Row type="ContainerControl">
<Cell type="ContainerControl" />
<Cell type="ContainerControl" />
</Row>
<Row type="ContainerControl">
<Cell type="ContainerControl" />
<Cell type="ContainerControl" />
</Row>
</Table>

Its a simple XML representation of what I'm trying to do. Now the controls that the user will drop on my control in design mode, should be added to Controls property of a Cell. Also I should be able to access a user dropped control like this:

Ctype(Ctype(Table.Controls(i), Row).Controls(j), Cell).Controls(k)

Any help in this regard will be highly appreciated...

</.NETFramework>




Windows Forms20  
 
 
Whatabohr





PostPosted: Windows Forms Designer, ContainerControl inside another ContainerControl Top

If you want to make this work, you would probably have to create a custom designer for your table control and do a lot of work to get this "feel" right in the designer.

Have you considered the approach of having your row and cell objects not be actual container controls but rather custom objects that define their own "Controls" collection (These items in these collections would be in actuality parented to the table itself, but you would still be able to access them via the cell Controls collection).


 
 
sohaibi





PostPosted: Windows Forms Designer, ContainerControl inside another ContainerControl Top

I am still waiting for any reply that might help me in implementing my design...

 
 
sohaibi





PostPosted: Windows Forms Designer, ContainerControl inside another ContainerControl Top

Thanx for the reply...

Currently I'm doing the same thing. I have my own Rows Collection inside my table. And each row has its Cells Collection. But these rows and cells are not control themselves.

The reason why I'm trying to make them controls is that I'm working on a Forms Designer application in which there will be table control. And there will be several other controls inside each of its cells. The problem comes when I'm going to save it as XML. I don't want to specifically code for my Table Control while saving it to XML or to database. I have written a general code, that is doing well with all the other controls except mine :(. That code searches for a "Controls" collection inside each controls to save its childs. I have that collection but I want only rows in it...

Hope this helps in understanding...

 
 
sohaibi





PostPosted: Windows Forms Designer, ContainerControl inside another ContainerControl Top

I am still waiting for some clues that would help me in implemeting my design...