The alignment goes well now, thanks Greg. No clue why I put it there, in other apps it was also outside the celltextpaint.
Yes, Emile, but it is not about the background color, that one is always black to make it readable. It is all about the CellTextPaint color and I am afraid it is this part in the code which does give the problem:
In CellTextPaint:
Dim arr() As String = Split(Me.Cell(row, column), EndOfLine)
For i As Integer = 0 To ubound(arr)
g.foreColor=bColor
g.DrawString(arr(i), x, y - g.TextHeight + i * g.TextHeight)
Next
What was done, we split up long text into a max length per line and after every maxlenth one put an EndOfLine. The above code will split the line on the EndOfLine markers and draw it on the next line.
For instance here is the code which is working fine for single line events:
in CellTextPaint:
If Row > -1 And Row < Me.ListCount Then
if me.CellTag(row,2)="eq" then
If val(Me.CellTag(row,1)) < 3 then
DisColor1=white
elseif val(Me.CellTag(row,1)) >= 3 and val(Me.CellTag(row,1)) < 4 then
DisColor1 = LYellow
elseif val(Me.CellTag(row,1)) >= 4 and val(Me.CellTag(row,1))<5 then
DisColor1 = dGreen
elseif val(Me.CellTag(row,1)) >= 5 and val(Me.CellTag(row,1))<6 then
DisColor1 = Yellow
elseif val(Me.CellTag(row,1)) >= 6 and val(Me.CellTag(row,1)) <7 then
DisColor1 = Orange
elseif val(Me.CellTag(row,1)) >= 7 and val(Me.CellTag(row,1))<8 then
DisColor1 = Red
elseif val(Me.CellTag(row,1)) >= 8 then
DisColor1 = Purple
end if
elseif me.CellTag(row,2)="ts" or me.CellTag(row,2)="hu" or me.CellTag(row,2)="fl" then
Discolor1=LBlue
elseif me.CellTag(row,2)="ls" then
Discolor1 = LRed
elseif me.CellTag(row,2)="fi" or me.CellTag(row,2)="li" then
DisColor1=dRed
elseif me.CellTag(row,2)="vu" then
DisColor1=LOrange
Else
Discolor1 = LGrey
End If
g.foreColor=Discolor1
end if
Moving up/down with the mouse over the text, using the mouse wheel to roll up/down the list does not affect the colors, each event does keep the color I assigned to it (in the if statement)