?
Solved

Where should I implement StretchBlt?

Posted on 2004-08-19
7
Medium Priority
?
336 Views
Last Modified: 2013-11-20
I need to zoom in and out of a bitmap. I am currently able to display the image onto the screen. So my question now is, where can I call the StretchBlt method in order to zoom in and out of the image?
0
Comment
Question by:mwcmp
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 48

Expert Comment

by:AlexFM
ID: 11850846
In WM_PAINT message handler, like any other drawing code. I guess you have BitBlt already, replace it with StretchBlt with some zoom coefficient.
0
 

Author Comment

by:mwcmp
ID: 11851686
Ya, I do have BitBlt.
But how can I have 2 OnPaint() in a Dlg?

For example, I click on a button call 'zoom', how can I pass it to call StretchBlt?
0
 
LVL 5

Accepted Solution

by:
Nass89 earned 400 total points
ID: 11857679
Hi,
You don't need two OnPaint().
Add a member variable and name it ZommFactor. When you click the zoom button set the ZoomFactor to the value you want and call OnPaint(). In OnPaint() use StrechBlt based on zoom factor.

Good Luck!
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 400 total points
ID: 11857903
I think you didn't understood the windows painting paradigm, the OnPaint function will be the unique point where paint takes effect (with few advanced exceptions), so, if you want to react to user input, like change zoom and pan, then save your new data as Nass89 specified, and force painting with RedrawWindow() or Invalidate() functions.
0
 

Author Comment

by:mwcmp
ID: 11860073
Thanks Nass89. Its done.

0
 

Author Comment

by:mwcmp
ID: 11860082
one more question...

>> if you want to react to user input, like change zoom and pan
How do I know that the user had click on the screen? (for panning)
0
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11860135
Create an event for the WM_LBUTTONDOWN message using the ClassWizard (press Ctrl-W), put it on your CView derived object.
every time the user clicks the left button the event will be launched (OnLButtonDown) passing you the client screen coordinates.
The same with WM_MOUSEMOVE and WM_LBUTTONUP
0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

764 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