LayoutEngine.Layout - currentChildControl.Left is always zero?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Peter Morris

    LayoutEngine.Layout - currentChildControl.Left is always zero?

    Hi all

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

    The relevant code is....

    public override bool Layout(object container, LayoutEventArgs
    layoutEventArgs )
    {
    base.Layout(con tainer, layoutEventArgs );
    Control parentControl = layoutEventArgs .AffectedContro l;
    int x = ControlSpacing. Width / 2;
    int y = ControlSpacing. Height / 2;
    foreach (Control currentChildCon trol in parentControl.C ontrols)
    {
    if (!currentChildC ontrol.Visible)
    continue;

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

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

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

    return false;
    }



    I would appreciate any help, thankyou!


    Pete



Working...