I am trying to create a custom listbox class (subclass of listbox) and have figured out how to draw left and right borders in CellBackgroundPaint event but can’t work out how to draw the top and bottom borders whether the listbox has contents or is empty.
The complex issue is trying to determine the first visible row and then drawing the line at the top of this graphics object for the row and determining the last visible or partially visible row and drawing the bottom line.
And if there are no rows or some rows but not all the way to the bottom of the listbox it becomes even harder or impossible as it stands for me right now.
I know I could go the container control route and place the listbox on a rectangle object or create separate border canvas or rectangle objects around it but I’d rather not do that if possible.
This won’t work Jeff. the graphics object is per cell not for the entire listbox so this will simply draw a line at the top of a specific cell and so would be at the top of all cells, not just the first visible and the last visible.