Listbox RowPicture

Hello everyone,

within a Listbox is set the RowPicture via Listbox.Rowpicture(Index) = Lock. Lock is a blue Glyph. Now i want to change the Picture, if a Row with RowPicture <> Nil is selected, to Listbox.Rowpicture(Index) = LockWhite. Otherwise i can’t see the blue Glyph. Notice, not all Rows has a RowPicture!

'Normal State Listbox.Rowpicture(Index) = Lock 'Selected State Listbox.Rowpicture(Index) = LockWhite

How can i do that?

Something like this:

  If MyListBox.Selected(Index) <> True And MyListBox.RowTag(Index) <> Nil Then
     Listbox.Rowpicture(Index) = Lock 
  ElseIf MyListBox.RowTag(Index) <> Nil Then
     Listbox.Rowpicture(Index) = LockWhite
  End If

Add a Change event. In this event add

if me.RowPicture(Listindex) <> nil then
me.RowPicture(Listindex) = Lockwhite
end if

Then you need to add a property to know which row was selected last so that you can reset the RowPicture for this row.

Or you don’t use RowPictures and do the drawing in CellTextPaint instead.

Added Property LastRow and added the Change-Event:

[code]If LastRow <> Me.ListIndex Then
If Me.RowPicture(LastRow) <> Nil Then Me.RowPicture(LastRow) = Lock
End If

If Me.RowPicture(Me.ListIndex) <> Nil Then
Me.RowPicture(Me.ListIndex) = LockWhite
End If

LastRow = Me.Listindex[/code]