On Mon, 16 Feb 2004 16:10:04 -0800, "Peter Steele" <ps*****@ciena.com>
wrote:
Okay, so I decided to try something with the MouseDown event and do this:
ListViewItem cell = ListView1.GetItemAt(e.X, e.Y);
A general note: For determining that someone's clicked on your
ListView you can simply use the SelectedIndexChanged (single click)
and ItemActivate (double click, configurable) events. You can get the
current row by examining the first element of
SelectedIndices/SelectedItems inside the event handler.
As for figuring out the column, that's something you'll have to do
yourself. Get the Columns collection, then the Width of each
ColumnHeader, then start adding up to see which point your mouse
cursor is at (the static property Cursor.Position returns the current
mouse cursor coordinates).
Note that Cursor.Position may be slightly changed from the click point
at the time you evaluate it so you might want to stick with the
MouseDown event for this particular purpose after all.
--
http://www.kynosarges.de