When I resize a column in a Listbox (Mac OS Sierra and Windows 7), Xojo 2016 R3 sometimes draws a white vertical line which looks like a grid line.
The lines appear only after resizing a column. Sometimes it is possible to resize the column in a way that the line disappears.
Mac OS:
Windows:
Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) Handles CellBackgroundPaint as Boolean
g.ForeColor = &cf3f6fA
g.FillRect(0, 0, g.Width, g.Height)
End Function
Any idea how to make the lines disappear? (Listbox.Invalidate and Listbox.InvalidateCell(-1,-1) do not change anything.
You need to return True to prevent the Xojo framework of drawing after you have drawn:
Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) As Boolean
g.ForeColor = &cf3f6fA
g.FillRect(0, 0, g.Width, g.Height)
Return True
End Function
I found that the lines disappear (on Mac OS in 100% of cases, in Windows in 90%) when I set the current column width in a script again:
Dim resize_string As String = ""
For i As Integer = 0 To Listbox1.ColumnCount - 1
resize_string = resize_string + Str( Listbox1.column(i).WidthActual) + ","
Next