Re: SetMapMode
- From: "Steve" <sredmyer@xxxxxxxxxx>
- Date: 23 Mar 2007 10:37:40 -0700
On Mar 23, 1:11 pm, "Mike Williams" <m...@xxxxxxxxxxxxxxxxx> wrote:
"Steve" <sredm...@xxxxxxxxxx> wrote in message
news:1174662317.657170.291410@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
FWIW This is one of the few (if not the only) time I have
run into something that simply could not be done with VB
...I think that speaks volumes for this development tool we
all know and love.
Actually I don't see it as being a problem with VB. If any application sends
a window handle or a DC handle and some coordinates to an external function,
for whatever purposes (drawing or hit test or anything else), then that
function can quite rightly be expected to assume that the coordinates are in
the current mapping mode of the DC. Anything else just doesn't make sense,
unless the function itself makes it clear that it expects its coordinates in
some other mode or (very unusually) provides a means for you to tell it to
interpret the coordinates in some other way. If you were to write your DLL
(or whatever it is you are writing) in C++ or in Delphi or whatever instead
of in VB then you would need to make exactly the same assumption. And the
DLL (whether written in VB or C++ or Delphi) would still get it wrong if the
user passed it coordinates that were not in accordance with the current
mapping mode.
Not so much a problem with VB...just something I want to be able to do
and feel I should be able to do and can not.
Not really wanting to start an argument here but are you saying that
you would not find this code to be a bit strange?
Private Sub lsvList_MouseDown(Button As Integer, Shift As Integer, X
As Single, Y As Single)
Dim lngX As Long
Dim lngY As Long
Dim objItem As MSComctlLib.ListItem
lngX = Me.ScaleX(X, Me.ScaleMode, vbPixels)
lngY = Me.ScaleY(Y, Me.ScaleMode, vbPixels)
Set objItem = lsvList.HitTest(lngX, lngY)
End Sub
I personally have never done this (and a good thing it is too since it
would not work (unless of coarse the forms scalemode was already
pixels)). Rather I would just pass in the X and Y coords given by the
MouseDown event and expect (in this case) the ListView to know how to
convert whatever units they are in into whatever units it needs to be
able to calculate the item located at that position.
Private Sub lsvList_MouseDown(Button As Integer, Shift As Integer, X
As Single, Y As Single)
Dim objItem As MSComctlLib.ListItem
Set objItem = lsvList.HitTest(X, Y)
End Sub
Thanks,
Steve
.
- Follow-Ups:
- Re: SetMapMode
- From: Mike Williams
- Re: SetMapMode
- References:
- SetMapMode
- From: Steve
- Re: SetMapMode
- From: Mike Williams
- Re: SetMapMode
- From: Steve
- Re: SetMapMode
- From: Mike Williams
- Re: SetMapMode
- From: Steve
- Re: SetMapMode
- From: Mike Williams
- Re: SetMapMode
- From: Steve
- Re: SetMapMode
- From: Mike Williams
- SetMapMode
- Prev by Date: Re: vb6 -v- Net!
- Next by Date: Re: vb6 -v- Net!
- Previous by thread: Re: SetMapMode
- Next by thread: Re: SetMapMode
- Index(es):