listview offset

L

lior_kovarsky

I have a listview with large icons. When user clicks, say the top left
of an icon, and in
the mouse down event i have
Point p = listview1.PointToClient(new Point(MousePosition.X,
MousePosition.Y)),
if I then compare p to listviewitem.Position, where listviewitem is
the icon the user clicked,
then in some cases the two points aren't equal. Anyone that can
explain why this offset exists
and is there a way to know what this offset would be? i.e. is there
e.g. a property of the listview
that holds this?


Thanks,

Lior
 
I

Ignacio Machin ( .NET/ C# MVP )

I have a listview with large icons. When user clicks, say the top left
of an icon, and in
the mouse down event i have
Point p = listview1.PointToClient(new Point(MousePosition.X,
MousePosition.Y)),
if I then compare p to listviewitem.Position, where listviewitem is
the icon the user clicked,
then in some cases the two points aren't equal. Anyone that can
explain why this offset exists
and is there a way to know what this offset would be? i.e. is there
e.g. a property of the listview
that holds this?

Thanks,

Lior

and how you know that the user clicked the top left most corner of the
icon?
 
L

lior_kovarsky

and how you know that the user clicked the top left most corner of the
icon?

The difference between points is sometimes as much as 21 in the X
axis, so
it is not because user didn't click exactly in the top left most
corner.
 
L

lior_kovarsky

and how you know that the user clicked the top left most corner of the
icon?- Hide quoted text -

- Show quoted text -

the difference in the X axis is sometime around 20 pixels, so it
cannot be explained
by the fact that the click was not exactly at the corner.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top