REAL Studio - Listbox Font

This morning I was looking around for how to adjust the font for a row of sales figures in a listbox. I wanted the refunds to show in red italic, and the regular records to show in the default black font. Luckily REAL Studio makes this easy ... as long as you know where to put the code. Function CellTextPaint(g As Graphics, row As Integer, column As Integer, x as Integer, y as Integer) As Boolean

IF InStr( me.RowTag( Row ), "") > 0 THEN g.ForeColor = RGB( 192, 0, 0 ) g.Italic = True END

End Function You can see that there are many parameters passed to the CellTextPaint method of the ListBox object. In my example, I was adding a "" as a flag to the RowTag of the listbox. If the rowtag had that flag, it was a refund and we set the graphics object to have a forecolor of a dark red, and set the Italics to be true.

What originally threw me is that I have to think of g (Graphics object) as the "row". A bit misleading but you can see it is very easy to adjust the font on a listbox. I hope this helps someone out! Even if it's a future version of me!