locked
SetCellPosition of a Control on TableLayoutPanel without is moving or reshaping RRS feed

  • Question

  • Does anyone know why, and how to avoid, TableLayoutPanel objects from metamorphisizing when a control is placed into one of its cells during SetCellPosition?  Here's a sample of code when it happens:

           

    DimImino(3) AsPanel


            Imino(0) =

    NewPanel


            Imino(0).Dock =

    DockStyle.Fill

            Imino(0).BackColor = gameColor

            Imino(1) =

    NewPanel


            Imino(1).Dock =

    DockStyle.Fill

            Imino(1).BackColor = gameColor

            Imino(2) =

    NewPanel


            Imino(2).Dock =

    DockStyle.Fill

            Imino(2).BackColor = gameColor

            Imino(3) =

    NewPanel


            Imino(3).Dock =

    DockStyle.Fill

            Imino(3).BackColor = gameColor

           

    Me.TableLayoutPanel2.Controls.Add(Imino(0))

           

    Me.TableLayoutPanel2.Controls.Add(Imino(1))

           

    Me.TableLayoutPanel2.Controls.Add(Imino(2))

           

    Me.TableLayoutPanel2.Controls.Add(Imino(3))

            CellPos(0) =

    NewTableLayoutPanelCellPosition(0, 3)

            CellPos(1) =

    NewTableLayoutPanelCellPosition(1, 3)

            CellPos(2) =

    NewTableLayoutPanelCellPosition(2, 3)

            CellPos(3) =

    NewTableLayoutPanelCellPosition(3, 3)

           

    Dimc AsInteger


           

    Forc = 0 To3

                TableLayoutPanel2.SetCellPosition(Imino(c), CellPos(c))

           

    Nextc



    William A Francis, III

    Thursday, December 13, 2012 5:47 AM

All replies

  • Hi William,

    Welcome to the MSDN forum.

    This codes should display four cells in a row of TableLayeroutPanel, could you please show us a capture of how it displays in your program?

    Thanks,


    Shanks Zen
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Friday, December 14, 2012 5:35 AM
    Moderator