Solved

Where should I implement StretchBlt?

Posted on 2004-08-19
7
325 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.
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.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.

895 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

15 Experts available now in Live!

Get 1:1 Help Now