Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27349

VS 2008 Fullscreen magnifier glass

$
0
0
Hello everyone, been a while since posting here...

I'm trying to write a full-screen magnification program in Visual basic .NET, which will likely utilize the Windows API (Pinvoke) to do it's magic.
The problem I am running into is that, when capturing the screen, you inevitably capture the window you display it on as well.
You get the 'infiniwindow' effect, where the captured image is captured and displayed again. It also results in strange glitches when you have a dynamic moving image.

I have tried several ways to capture the screen and displaying it WITHOUT ending up capturing my own drawn window. To do so, I need to draw 'above' the zero-DC buffer.

This is the method I used to draw to the screen (no topmost window as that gets inevitably captured too):
PHP Code:

Public Class Magnifier
    Dim screen 
As Screen
    Dim bounds 
As Rectangle
    Dim g 
As Graphics
    Dim zoom 
As Double

    
Public Sub New(ByVal screen As Screen)
        
Me.screen screen
        Me
.bounds Me.screen.Bounds
        Me
.Graphics.FromHwnd(IntPtr.Zero)
    
End Sub

    
Public Sub Dispose()
        
g.Dispose()
    
End Sub

    
Public Sub SetZoom(ByVal zoom As Double)
        
Me.zoom zoom
    End Sub

    
Public Sub Draw()
        
g.CopyFromScreen(Cursor.Position, New Point(00), New Size(400400))
    
End Sub
End 
Class 

As you can see, getting the Graphics for handle IntPtr.ZERO results in the same graphics used to capture the screen. So, I end up capturing myself.
Draw is fired elsewhere using a timer.

Is there some way to capture the screen while EXCLUDING everything I rendered 'on top' of it? Can it be done with a fullscreen topmost window?
Alternatively, is it possible to be 'the man in the middle' transforming the graphics right before it is drawn to screen?

Viewing all articles
Browse latest Browse all 27349

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>