locked
Positioning the child controls RRS feed

  • Question

  • <.NET Framework 1.1>

    I am trying to develop a table control for Windows these days. It should look like an HTML Table control with rows and cells. For this purpose, I inherited from ContainerControl and added a ParentControlDesigner to it.

    I overrided the OnPaint method to draw the table border and all the rows and cells in the table. Now I want that if the user drag and drops any other control on to it. I should be notified that a control has recently been added; so that I can alter its location within one of the cells in my table.

    I tried to override the OnDragDrop of ParentControlDesigner, and changed the (x,y) to my  desired location. But it didn't work. Plz help....

    Waiting for an early response

    Saturday, May 27, 2006 1:15 PM

Answers

  • You need to override the OnLayout event and perform you own custom sizing and positioning of each child control according to your cell arrangement. By default this method will just leave each child control in the location it is placed when added to the container.

    Phil Wright
    http://www.componentfactory.com
    Free user interface library for .NET2

    Saturday, May 27, 2006 2:01 PM

All replies

  • You need to override the OnLayout event and perform you own custom sizing and positioning of each child control according to your cell arrangement. By default this method will just leave each child control in the location it is placed when added to the container.

    Phil Wright
    http://www.componentfactory.com
    Free user interface library for .NET2

    Saturday, May 27, 2006 2:01 PM
  • Thanx for the quick response. Lemme check it :)
    Saturday, May 27, 2006 2:10 PM