LayoutEngine.Layout - currentChildControl.Left is always zero?

May 13 2008 4:24 PM
Hi all

This is driving me mad!  Can anyone tell me why the Left property of my
SelectImageItemControl is always zero when it should vary?

The relevant code is....

  public override bool Layout(object container, LayoutEventArgs
layoutEventArgs)
  {
   base.Layout(container, layoutEventArgs);
   Control parentControl = layoutEventArgs.AffectedControl;
   int x = ControlSpacing.Width / 2;
   int y = ControlSpacing.Height / 2;
   foreach (Control currentChildControl in parentControl.Controls)
   {
    if (!currentChildControl.Visible)
     continue;

    currentChildControl.Location = new Point(x - currentChildControl.Width /
2, y - currentChildControl.Height / 2);

    // *** Why is currentChildControl.Left 0 when x is a negative number?

    x += ControlSpacing.Width;
    if (x > parentControl.ClientRectangle.Right - ControlSpacing.Width / 2)
    {
     x = ControlSpacing.Width / 2;
     y += ControlSpacing.Height;
    }
   }

   return false;
  }



I would appreciate any help, thankyou!


Pete