![]() | |
![]() |
| | Thread Tools | Search this Thread | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Hi, I'm trying to create a simple magnifier program, where it would magnify an small area under the mouse coordinates, catch is, it should also capture and magnify Transparent Forms, and paints everything to the form. I've manage to solve this problem using the follwing method. 1. Create new Bitmap variable and save it inside the Graphics variable Dim b As New Bitmap(CInt(blitAreaX), CInt(blitAreaY)) Dim g As Graphics = Graphics.FromImage(b) 2. Use BitBlt Api to capture entire desktop and using "SRCCOPY Or CAPTUREBLT" at the "dwRop" parameter. ================================================== Public Const CAPTUREBLT As Integer = &H40000000 Public Const SRCCOPY As Integer = &HCC0020 ================================================== 3. Use e.Graphics.DrawImage to draw the specified "Rectangle Coordinate & Size" of both source & destination to the form. ----------------------- My problems is that I find this method slow because the BitBlt Api captures the "entire" desktop, which makes the process slow. It would be faster if I can only capture the desired area. I tried using StretchBlt, which is the most logical thing to do, however using StretchBlt to paint directly to the form "Does Not" paint transparent forms. I have tried many approches to this but to no avail. Approaches like, a) Use StretchBlt to draw directly to form and b) Use StretchBlt and save result at a BMP Variable which e.Graphics would draw. Both of methods fail to paint transparent forms. Any solution, suggestion or insights on how to create a fast, (if possible flickerless) magnifier program that could also capture/magnify transparent forms will be very much appreciated. Thank you, Henry Wu Since its graphics/drawing related, I belive this is the more proper group for my question than 1st one I've tried. For the complete thread and source code of my work, kindly visit the ff link: http://groups.google.com.ph/groups?h...en%26lr%3D%26i |
#3
| |||
| |||
|
|
I don't know why you say that the BitBlt API captures the whole screen. The BitBlt API can capture whatever portion you tell it to. The destination rectangle size will determine the amount of image copied. The destination location should be 0,0 and the source X and Y should point to the upper-left corner of the area you want to grab. -- Bob Powell [MVP] Visual C#, System.Drawing |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
Hi Bob Powell, I finished the sample magnifier project that could magnify transparent windows too. However, flickering is still a problem, If you know any way on how to remove the flickering, I would really be very gratefull for it! Thanks, Henry Sample Magnifier Project: http://wuhenry.beigetower.org/MagnifierXP.zip After some research I found out that StretchBlt doesnt support CaptureBLT. http://groups.google.com.ph/groups?h...ered%2Bwindows |
#6
| |||
| |||
|
#7
| |||
| |||
|
|
Hi James, Thanks in part to Dr. Screwup I finally got the Magnifier working the way I want it. http://wuhenry.beigetower.org/MagnifierXP-Final.zip A Seperate repaint function was the trick to stop the flickering. Dont call any invalidate, it will surely cause flickering. Thanks, Henry |
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
| |