CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Apr 2007
    Posts
    68

    FlowControlPanel control alignment help

    Hi All

    I am trying to automatically create a series of 2 labels on a FlowControlPanel but I just cant get the allignment correct.

    I have the following coded.

    Code:
                   Dim x As Integer
                          For x = 0 To 50
                        Dim lbl As New Label()
                        Dim Tlbl As New Label
                        With lbl
                            .Size = New Size(400, 20)
                            .BackColor = Color.FromKnownColor(KnownColor.ControlLight)
                            .FlatStyle = FlatStyle.Flat
                            .Font = New System.Drawing.Font("Century", 12)
                            .TextAlign = ContentAlignment.MiddleLeft
                            .Margin = New Padding(124, 10, 0, 0)
                            .Text = "Downtime " & x
                       End With
    
                        With Tlbl
                            .Size = New Size(100, 20)
                            .BackColor = Color.FromKnownColor(KnownColor.ControlLight)
                            .FlatStyle = FlatStyle.Flat
                            .Font = New System.Drawing.Font("Century", 12)
                            .TextAlign = ContentAlignment.MiddleLeft
                            .Margin = New Padding(10, 10, 0, 0)
                            .Text = "Time " & x
                        End With
    
                        DataFLP.Controls.Add(lbl)
                        DataFLP.Controls.Add(Tlbl)
                    Next
    This basically creates a series of 2 labels that span horizontally as I have it set to Top Down, so that I get a horizontal Scroll bar instead of vertical.

    All the controls are added fine but the problem I am having is all the tlbl labels are added next to my lbl labels but under the lbl label. I want my labels side by side not side then under.

    I want the Time Labels and the Downtime labels alligned side by side.

    I have played with the padding and margins but just cant get them alligned, I have attached a picture of what I am getting and what I am looking for.

    Cheers

    Dj
    Attached Images Attached Images  

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured