Magnifying Glass - demonstrates different ways to obtain or create proper DC and use BitBlt - StretchBlt functions | CodeGuru

Magnifying Glass – demonstrates different ways to obtain or create proper DC and use BitBlt – StretchBlt functions

Environment:VC5/VC6 Generally the sample demonstrates different ways to obtain or create proper DC and use BitBlt – StretchBlt functions. It is another ZoomIn demo application created with doc-view architecture. CView derived class experienced minimum changes from AppWizard generated one. CImageWnd window covers CView derived class window. CImageWnd contains a copy (mirror) of CView derived class […]

Written By
CodeGuru Staff
CodeGuru Staff
Mar 25, 1999
2 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

Environment:VC5/VC6

Generally the sample demonstrates different ways to obtain or create proper DC and
use BitBlt – StretchBlt functions.

It is another ZoomIn demo application created with doc-view architecture.
CView derived class experienced minimum changes from AppWizard generated one.

CImageWnd window covers CView derived class window.
CImageWnd contains a copy (mirror) of CView derived class window bitmap to draw. CImageWnd window
becomes transparent when magnifying glass is inactive and draws a “lens” over the bitmap when active.
The “lens” is a small zoom window. Magnifying Glass doesn’t depend on a view contents.
It is easy to modify CMgnView::OnDraw or CMgnView::OnEraseBkgnd and Magnifying Glass still will work with
another contents.

To activate or deactivate magnifying glass – press button on a toolbar.

To magnify a portion of a view – activate magnifying glass, press left mouse button and move “lens” around a view.

To change magnifying glass size, shape or zoom – activate magnifying and click a view with right mouse button.
It is possible to create several views just use file – new command.
Note that for each view magnify glass keeps its own properties.

It is easy enough to make a “lens” astigmatic (cylinder) or add another “optical effects”.

I couldn’t remove some “optical side effects”. When magnifying glass is slowly moved from outside a
frame inside it over a border you see a “diffraction grid”.

Download source – 27 Kb

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.