Implementing zoom controls in MFC

Posted on 2009-04-27
Last Modified: 2013-12-14
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.

Question by:arrayjet_vin
    1 Comment
    LVL 39

    Accepted Solution

    >>>> 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.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Join & Write a Comment

    Update (December 2011): Since this article was published, the things have changed for good for Android native developers. The Sequoyah Project ( automates most of the tasks discussed in this article. You can even fin…
    How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from ( Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
    The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now