Implementing zoom controls in MFC

I would like to develop a 'print preview' facility for my application to show an overview of a slide with rectangular arrays of sample spots on it.

The slides typically measure 25 x 75 mm and the spot samples are typically 0.1 mm in diameter. There is usually a 2mm gap around the perimeter of the slide where no spots are printed.

The distance between spots (pitches) is accurate to 0.01mm. Pitches of 0.20 and 0.29 mm for example would need to differentiated in the pixels. Representing the spots themselves, 100% accuracy is probably not crucial at this stage as long as the spots are visible and don't overlap.

As a novice in this area I would appreciate advice on what techniques to use in order to create a bitmap representation of the slide/spots and to view the slide layout using some arbitrary levels of magnification.

This does not have to be sophisticated - a 1:1 representation plus a smaller and larger magnification to start with.

For larger magnifications I will probably need to know about implementing horizontal / vertical scroll controls as well, but I will tackle this later.

I would like to find out about any programming and scaling techniques that I should be aware of in order to properly implement a zoom facility. I have recently been playing with the StretchBlt function to alter image sizes and it seems ok, however any other relevant information would be useful.

Don't hesitate to ask for any further information or clarification.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

>>>> I have recently been playing with the StretchBlt function to alter image sizes and it seems ok
If using the StretchBlt on a bitmap of screen device, you'll get bad results for larger zoom factors as the amount on pixels is too small. A bitmap stored in a file may have a multiple of screen resolution and when using an appropriate device (e. g. a printer device with higher resolution) for the StretchBlt, the result finally mapped to screen resolution might be much better than when stretching the already reduced image information. If you don't want to do the job yourself (what indeed is a big task) I would recommend to using an appropriate graphic library which was able to do the zoom on high resolution input and finally display the results on the screen in best quality possible.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Editors IDEs

From novice to tech pro — start learning today.