I have a parent form (Form1) that holds four childForms (childForm1, childForm2, childForm3, childForm4). The childForms can get pretty big, and I'd like the user to be able to use the scrollwheel on their mouse to zoom the screen in and out so that they can get a 'big picture' view of what's going on.

The important parts are that the user can accomplish this using their mousewheel, all of the forms on the screen shrink/grow at the same time, and the action/animation looks smooth enough to not induce motion sickness.

Normally I post whatever code is giving me a problem, but I haven't even gotten part of the way there. I've been researching and attempting to get this to work for the past 11 days and I haven't had a single success. Please help if you can.

-H

CharlieHolt commented: It's an interesting question I'd like to see an answer to +1

Recommended Answers

All 3 Replies

What do you have on the forms you would like to change (shrink or grow)? Controls? Which one? I this the only way to accomplish what you want is , that on every scroll of the mouse, you would have to recalculate and reposition all the controls (all the stuff) on the form. But this is not so tuff I would say. You have to dfine for how much one mouse scroll is going to be (in inches) so then for example:

NOW:
textBox1:
- Location = 100,200
- Size = 100, 23
- Text size = 10
- ...

You want to shrink it (one scroll of a mouse) by 10 inches:
You have to set new parameters for the textBox:
- Location: 90, 90
- Size: 90, 23
- TextSize 10

but you also have to consider that if you scroll the wheel by 10 times the X and Y axes can come to 0, if 11 times, it will be even -10. But you dont want to have it.
So some if/esle statemets will be needed as well.

For sure there is pretty much of work, depending on how many things (controls) you have on each form.
But there is no other way, I would say (at least not easier).
So, happy coding, and good luck.

But I˙m still interesting to know, what kind of controls you have on each form.
bye,
Mitja

I would like everything about the forms to shrink/grow (including the forms themselves). Right now I only have some buttons, images, and textboxes on each form.

There's no way to accomplish this without redefining each and every control/aspect of each form every time the mousewheel moves? There is no method out there that treats a form and all of its parts as a single entity?

The position of the controls can be changed. This can be done with setting the "Anchor" property in the Properties windows. By default all controls are set to allign on TOP-LEFT corner. So when you move bottom righ corner (grow it) all controls will stay on the same position. But if you will allign them by BOTTOM-RIGHT, the controls will move to the right, button corner.
For example, if you set to allign to all 4 corners, the control will grow to all 4 directions.

Try to mess with this option a bit.

But what concerns the size of controls, I`m affraid you wil have to set the manually.
There is not so much code, you only need to do a common common code with some if/else statements, which will look on for how much the form has shrinked/grown and the code will re-set the size of controls.

Hope this helps a bit,
Mitja

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.