Hi Cwitt, the "imageless" Image control isn't really disabled -- at least the Initialized event still fires regardless
. But mouse events only fire when the pointer is over non-transparent areas of the image.
The Image has to be put into some or other container such as a Border control.
So, for example, you could get the mouse position (in device independent units) like this:
Code:
Private Sub Image1_MouseMove(sender As Object, e As MouseEventArgs) Handles Image1.MouseMove, Border1.MouseMove
Console.WriteLine(e.GetPosition(Border1))
End Sub
This assumes that Image1 has its Stretch property set to Fill and StretchDirection to Both, so the Image coordinates will be the same as the Border coordinates (equivalent to PictureBox.SizeMode.Stretch).
If you use a different Image setting such as UniformToFill (more like PictureBox.SizeMode.Zoom) you'd have to do some arithmetic to get the coordinates to be consistent. It would be easier in that case just to use the Border1.PreviewMouseMove event instead of MouseMove, since that would give the same mouse position whether or not the image is showing.
BB