Here's a bit of code using bitblt and the Graphics object..should work in
2005 but don't know since I use 2003:
Private Function CopyRect(ByVal Src As Graphics, ByVal RectF As Rectangle)
As Bitmap
'Create Empty BitMap in Memory
Dim srcBmp As New Bitmap(RectF.Width, RectF.Height, Src)
Dim srcMem As Graphics = Graphics.FromImage(srcBmp)
'Get Device contexts for Source and Memory Graphics Objects
Dim hdcSrc As IntPtr = Src.GetHdc
Dim hdcMem As IntPtr = srcMem.GetHdc
'Get The Picture inside the Rectangle
BitBlt(hdcMem, 0, 0, RectF.Width, RectF.Height, hdcSrc, RectF.X,
RectF.Y, 13369376)
'Return Clone of the BitMap
Dim rb As Bitmap = CType(srcBmp.Clone(), Bitmap)
'Clean Up
Src.ReleaseHdc(hdcSrc)
srcMem.ReleaseHdc(hdcMem)
srcMem.Dispose()
srcMem.Dispose()
Return rb
End Function
--
Dennis in Houston
"fripper" wrote:
Is there a way to use the windows bitblt function in a VB 2005 app? bitblt
requires device context parameters for the source and destination controls
but those are not used in VB 2005. Is there some way around this? I have a
program that uses a timer ... when it fires I want to copy a small block on
the screen to a particular location.
Thanks