Example: ListBox with Background Image

Lena smiles behind cells (columns are resizeable).

Sample project is here.

1 Like

Very Suspicious of random links like this.
Whats this about?
Need help?
Showing some technique?

If no reply, this may be SPAM or worse…

It’s an example showing how to give a desktop ListBox a seamless background image using CellBackgroundPaint.

Works fine on Xojo 2015r1 (with some regression).

But the image (thus lovely) is not appropriate: reading the text is close to impossible.

BTW: a jpg (in this case) loaded with Picture.OpenVector ?

Yes.

A bit tall, but the Rainbow effect is a must. I created the artwork for someone who’s addres was 15 Rainbow Drive… :wink:

No tricks.

Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) Handles CellBackgroundPaint as Boolean
  Var left,top,columnWidth,rowHeight as Integer
  Var i as Integer
  
  columnWidth=me.ColumnAt(column).WidthActual
  rowHeight=me.RowHeight
  
  For i=0 to row-1
    top=top+rowHeight
  Next
  For i=0 to column-1
    left=left+me.ColumnAt(i).WidthActual
  Next
  
  g.DrawPicture Self.p,0,0,columnWidth,rowHeight,left,top,columnWidth,rowHeight
End Function
1 Like