How to get the RED OUT

I have a listbox and as shown it has red in each cell.

How can I get it removed or can’t I ?

Do you have something in the CellBackgroundPaint event?

Just this code in celltextpaint. have no cellbackgroundpaint event.

[code] //if selected,
//fill in row with dark blue color and white text
//otherwise leave it default
if me.selected(row) then
g.foreColor = rgb(66,82,255)
g.fillrect 0,0,g.Width,g.height
g.foreColor = rgb(255,255,255)
g.Bold = True
end if

me.InvalidateCell(-1, -1)[/code]

What does that final InvalidateCell do for you?

nothing, I was trying different things and forgot to remove it.

This red happens in each cell I add.

What color is your normal highlight color?

It seems like you should split this code among too events, CellBackgroundPaint to create the blue box, then CellTextPaint to set the text color and bold. It might be the normal highlighting bleeding through.

This doesn’t happen for me in OSX, just on Win7. And Kem is right - if you put the blue box part in CellBackgroundPaint you don’t get that bleedthrough.

Ug, “too events”. Because I just learnt to spel.

Well that does not work either. if I don’t put the code in CellTextPaint I don’t get the blue box.

That doesn’t make sense. This is something I do all the time.

Can you copy the entire event declaration and post it here?

RED if I have no CellTextPaint or CellBackGroundPaint events

This is just a listbox with some default text and a CellTextPaint event. thats it.

I tried your suggestion and added CellBackgroundPaint and split the code but
it did not work.

Don’t forget to return true in the CellBackgroundPaint.

That did it… RETURN TRUE

I believe that this should correct itself if you return the TRUE from the background paint event. You are seeing that red because the width of the writable area in the celltextpaint event is a little less than that of the width in the background paint event to offset the text a bit from the left edge of the cell. Consequently it does not fully cover the red from the background paint. If you don’t return TRUE from the background paint event then the normal background processing takes place, painting what would normally be the background color.

This works even if I put all this code in the CellBackgroundPaint event.

[code] //if selected,
//fill in row with dark blue color and white text
//otherwise leave it default
if me.selected(row) then
g.foreColor = rgb(66,82,255)
g.fillrect 0,0,g.Width,g.height
g.foreColor = rgb(255,255,255)
g.Bold = True
end if

Return True[/code]

Is it ok to do it this way or should I split it ?

I myself would do the background in the background event and the text in the text paint event just to be sure that each item is being done where it was intended to be done. And, of course, return true from the background paint event.

OK… Thank you all for the help…