Scaling mouse input for zooming

In my app, it allows you to zoom in and out. I have the visuals sorted. How can I scale the mouse input so it goes well with the visuals?

Thanks

take a Canvas and set the event “MouseWheel” to:
me.Width = me.Width + deltaY
me.Height = me.Width

And in the Paint event:
g.ForeColor = &c95959500
g.FillOval 0,0,g.Width,g.Height

[quote=111267:@Horst Jehle]take a Canvas and set the event “MouseWheel” to:
me.Width = me.Width + deltaY
me.Height = me.Width

And in the Paint event:
g.ForeColor = &c95959500
g.FillOval 0,0,g.Width,g.Height[/quote]
Thanks that just happens to save me time with writing the code for scrolling but this isn’t what I was trying to ask for. I am sorry that I didn’t make it clear enough.

I meant mouse movement and click responses. I want to scale up all of the rectangles. I am guessing that I will have to do this manually.

Thanks

rw_x=(x-rw_offset)/zoom

same of Y (rw_ indicate REAL WORLD) x, y are mouse
offset is based on how much you may have scrolled

[quote=111353:@Dave S]rw_x=(x-rw_offset)/zoom

same of Y (rw_ indicate REAL WORLD) x, y are mouse
offset is based on how much you may have scrolled[/quote]
Thanks. I will try to use what you have just told me.

So how do I set rw_offset?

in my apps… rw_offset is controlled by the scroll bars… it your image just zooms but you don’t scroll it… just leave that out or set it to ZERO, otherwize you will have to use a similar equation to take the Scroll value and convert it to RW value (x/zoom)

Ah…very helpful. Thanks

What I have done is I have created a class that subclasses canvas. For the mouse move event I executed an event definition using ‘MouseMove(x / zoom, y / zoom)’. I does not seem to work.

Thanks