Steve Guest
|
Posted: Tue Aug 23, 2005 10:53 am Post subject: Using OnDrawItem in a TListView |
|
|
I see a lot here about taking an image (typically a thumbnail) and
displaying in a TListView by intercepting the OnDrawItem event. I
want to display an image with text, very similar to the icon view of
the Windows Explorer. I've seen several references to how to do
it but all the explanations leave a little out, assuming more
knowledge than I have at this point.
I've posted this before with no responses so maybe if I rephrase it...
From what I can tell, I intercept the formation of the cell in the
ListView with the OnDrawItem event. At that point I determine the
coordinates (they are either passed as part of the OnDrawItem or I can
get them from the DispRect property, can't remember which right
now...) and I use those to put the image on the ListView with a Draw.
Then I do some calcs and figure out based on the image size where to
put the text so that it is next to the image (or under or whatever)
and use a TextOut method to do that?
Is that the best/usual way of doing such a thing? If not, is there a
better way?
Also, the OnDrawItem event seems to prevent the normal output, the
output that triggered the OnDrawItem in the first place, from being
written at all. If once I get control in the OnDrawItem, I don't do
anything, nothing is output. Once I get control in the OnDrawItem
event, if I determine that I really don't need to manipulate the
output and would be happy with the output that triggered the
OnDrawItem, is there a way that I can just let the normal output
proceed, kind of a "nevermind, you go ahead..." to the OnDrawItem?
Any help will be greatly appreciated...
Steve
|
|