0

This is probably the coolest most annoying bug I have ever come across.

I have a flow layout panel with a listview inside of it.

The ListView has a size of 500 The FlowLayoutPanel has a size of 800

When the user clicks a button a new control is created with a size of 400

the size of the FlowLayoutPanel Increases to 900

The Size of the ListView decreasesto the flowlayoutpanel size(900) - new control(400) minus 20(margin)

The Control is added into the FlowLayoutPanel

The problem is when a user has the Windows Settings Of Font size set to Medium Instead of amsller, the math messes up and sticks the note control behind the listview.

Has anyone else came across this problem?

Dim noteControl As New AddNote(CurrentEventID, "Followup", False, ConnectionID)

    noteControl.Size = New Size(500, flpMain.Height - 2)

    noteControl.cmbNoteType.Visible = False
    noteControl.Anchor = AnchorStyles.Right

    ListView1.Size = New Size(flpMain.Size.Width - noteControl.Size.Width - 45, ListView1.Size.Height)

    flpMain.Controls.Add(noteControl)

    flpMain.Width = Me.Width - 10

    For Each mycontrol As Control In flpMain.Controls
        If mycontrol.Name.ToString = "AddNote" Then

            y = CType(mycontrol, AddNote)
            mycontrol = y

            ListView1.Width = flpMain.Width - y.Width - 45

        End If
    Next

    If flpMain.Controls.Count = 1 Then

        ListView1.Width = flpMain.Width - 10

    End If

    Dim columns As Integer = ListView1.Columns.Count

    ListView1.Columns(columns - 1).Width = ListView1.Width

    For index = 0 To columns - 2

        ListView1.Columns(columns - 1).Width = ListView1.Columns(columns - 1).Width - ListView1.Columns(index).Width

    Next
DidIReallyWriteThat
  • 1,033
  • 1
  • 10
  • 39
  • What has the size of what? What Controls do you create? Any Anchors set? – TaW Jun 20 '14 at 14:21
  • i have no idea how that happened i put the values in, one sec I will edit. – DidIReallyWriteThat Jun 20 '14 at 15:18
  • What type of control do you create? You should post the code you describe.. – TaW Jun 20 '14 at 15:24
  • its a new custom control form. The problem isnt the code. The problem is that when the system setting is set to small font it creats perfectly, when the system setting is set to medium font it creates the second control to large and puts it behind the listview control – DidIReallyWriteThat Jun 20 '14 at 15:27
  • Some controls, like ListBox have a IntegralHeight property, which effect depends on the font size of the control; does your mysterious 'custom control form' have that? It is allways the code and seeing it (the relevant parts) is better than being told about it.. – TaW Jun 20 '14 at 15:32
  • I will add the code just for you :) – DidIReallyWriteThat Jun 20 '14 at 17:07
  • You should be using ClientSize instead of Size when you care about the interior space of a control. – LarsTech Jun 20 '14 at 17:43

0 Answers0