Solved

Where should I implement StretchBlt?

Posted on 2004-08-19
7
330 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
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
format the code in java 6 101
canBalance challenge 34 98
ASP.NET C# MessageBox.Show Showing a modal dialog box or form when the application ... 2 164
Making an alias 7 101
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

829 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