Solved

Where should I implement StretchBlt?

Posted on 2004-08-19
7
329 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
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 100 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 100 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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Expand LInux Boot partition remotly 3 91
iSeries DB2 Query 2 95
fizzArray2 challenge 1 80
zeroMAx challenge 20 104
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

803 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