![]() |
Click here to advertise with us
|
|
|||||||
| Graphics/GDI+ Graphics discussion for VB.NET applications, Winforms, Web, Compact Framework, etc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
This may be a stupid question, but I'm fearless...
There is a form (let's say Form A) in my app that uses a reduced snapshot of a different form (Form B) in the same app. The way I've been doing this is: 1st- Display the form that I need to copy. (Form B) 2nd- Run through a quick "BitBlt" API call & save the image to a shared bitmap variable. 3rd- Display Form A and assign the bitmap to a picturebox in Form A 4th- Close Form B This works OK. I was just wondering if there was a way that I could capture the image of Form B without actually displaying it to avoid the distraction of having Form B show briefly just before Form A is shown... say if there were a way to construct Form B in memory and then capture the image from there. It would appear a little more professionally constructed that way. Is this reasonably do-able? |
|
|||
|
Use the hidden form's DrawToBitmap method. For example, assuming Form1 is hidden:
Code:
Dim bmp As New Bitmap(Form1.Width, Form1.Height) Dim rect As New Rectangle(0, 0, Form1.Width, Form1.Height) Form1.DrawToBitmap(bmp, rect) bye, Vic |
|
|||
|
This is a great way (and a shorter way than I was using) to capture a bitmap of the screen. But unless I'm screwing up somewhere, it appears that I have to display the form 1st... which is what I was trying to avoid.
-Edited: Well it seems that I can show the form and then immediately hide it and then use your approach... So as far as the users' point of view goes, it never really appears. -(Barely a flash on the screen)- I guess it's a cheat, but it works for me! Thanks for your help!!! Last edited by ALX; 02-10-2010 at 11:47 PM. |
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|