Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Get (Print) the screen below the form

$
0
0

It seems that this problem is likely that i'm making a glass window on windows XP.

I've used this code

    Public Function GetScreen(ByVal frm As Form) As Bitmap
        Dim hwNd As Long
        Dim targetDC As Long
        Dim pichdc As Long
        Const vbSRCCOPY As Long = &HCC0020
        bmp = New Bitmap(frm.Width, frm.Height)
        grf = Graphics.FromImage(bmp)
        hwNd = GetDC(GetDesktopWindow)
        targetDC = GetWindowDC(hwNd)
        pichdc = grf.GetHdc
        BitBlt(pichdc, 0, 0, frm.Width, frm.Height, hwNd, frm.Left, frm.Top, vbSRCCOPY)
        grf.ReleaseHdc(pichdc)
        ReleaseDC(hwNd, targetDC)
        grf.Dispose()
        Return bmp
    End Function

to get the image below the 99% opacity form since graphics.copyfromscreen eats too much my CPU. (This worked very well at the first time: just 5% CPU used.

Yes. This stuff worked with a form which has a little ammount of control. But a large form with many controls is different.

It totally drinks up 50% of my CPU (dual cores).

I remember that there is an app (says Komalo's BorderSkin) could solve this very, very well on .NET 2.0. (He uses a c++ lib to hook up the windows and main c# window to draw any other window - I guess.)

So I'd be pleased if anyone helped me solve out this problem. (Especially if Komalo is here :)


Call me Zenocoding


Viewing all articles
Browse latest Browse all 12583

Trending Articles



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