Re: create a bitmap from a rectangle of the screen
This code might be helpful to you...
VB Code:
Declare Function GetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Integer) As Integer
Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (ByVal hDestDC As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal xSrc As Integer, ByVal ySrc As Integer, ByVal dwRop As Integer) As Integer
Public Function ScreenGrab(ByVal SourceRect As Rectangle) As Bitmap
'returns a screengrab of a known area of the desktop
Dim destBMP As Bitmap = New Bitmap(SourceRect.Width, SourceRect.Height)
Dim gDest As Graphics = Graphics.FromImage(destBMP)
Re: create a bitmap from a rectangle of the screen (resolved)
Glad to help
Blitterchip was intended to be used for copying image data between 2 controls on the same form, rather than what you wanted but now you have mentioned it I'll add this sub to that class and revise the codebank thread
Last edited by wossname; May 24th, 2005 at 08:52 AM.
Re: create a bitmap from a rectangle of the screen (resolved)
well, none really, I just could figure out how to make it do what I needed. I think it is more about not understanding how Bitblt works. It makes a bit more sense now though.
kevin
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers.
A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________
Last edited by kebo : Now. Reason: superfluous typo's
Re: create a bitmap from a rectangle of the screen (resolved)
Originally Posted by wossname
Glad to help
Blitterchip was intended to be used for copying image data between 2 controls on the same form, rather than what you wanted but now you have mentioned it I'll add this sub to that class and revise the codebank thread
cool
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers.
A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________
Last edited by kebo : Now. Reason: superfluous typo's
Re: create a bitmap from a rectangle of the screen (resolved)
Originally Posted by wossname
Done.
...
This must be worth a rating
It asolutely is..... I need to spread some around first though. I'll be back.
Thanks again. With your help I was able to taken dozens of screen shot of my app in only a few minutes. Way kick @ss cool I say!
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers.
A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________
Last edited by kebo : Now. Reason: superfluous typo's