Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win


How to capture a form's image? The form is a child form of MDI form

Posted on 2004-10-08
Medium Priority
Last Modified: 2010-05-02

I have troubles to capture a form's image (the form got all kinds of controls on it, e.g. textbox, line, shapes etc). I need capture the image of the form (how it looks like) and save it into a BMP file or JPEG file. Another hurdle is this form is a child form of a MDI form. The MDI form got menu on it. I want to capture the child form's whole image even though I can only see a part of the form.

I tried to use CaptureForm(frm1) to do it. The problem I encountered is since the function can only capture the part of the form which can be seen from the screen (the MDI Form cover other part of the form). So I have to copy all the controls to another form, then display the form as full-screen image and capture its image at that point, which is kind of dumb.

Wish some smart sample code from you!

Thanks a lot for your help.

Question by:yi02
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3

Expert Comment

ID: 12265872
download bellow zip file. it will give you all of u want


LVL 16

Expert Comment

ID: 12285741
You could always use Form1.PrintForm to print the entire form.  If you have a PDF printer (such as Acrobat Distiller, or CutePDF), you can print to this printer object.

Not a perfect solution, but a simple one...

Author Comment

ID: 12292373
Hi, Dear Shaival:

Thanks a lot for your suggestion. Indeed I knew something like that as I described in my question. the program from the site you suggested, still can not solve my problem.

Use a practical example to describe my problem: image a workbook opened and displayed within the microsoft Excel program, What I tried to do is to capture the image of this opened workbook even I can not see all the parts of this workbook ( part of it is being hided within the main Excel program window). My problem is very much like this:  I try to save or print the image of a child form of MDI form, which embedded inside the MDI form, even though we can not see all the parts of it.

The program you suggested only captures whatever can be seen in the active window or whole screen. If some parts are hiden and are not able to be seen, they still can not be captured.  I already figure out a way, although it is a clumsy one to deal with it. First I copy all the controls of the child form that I attempt to capture the image to a different form, which is not the child form of the MDI form, then make it full screen and then capture the image at that point. Now, I am looking for a better solution than that. Could you still help me out? Or somebody else?

Thanks a lot.


What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


Author Comment

ID: 12292430
Dear jimbobmcgee:

Thanks for your comments. My problem seems more demanding than this solution. Could you please offer a better one? I really need help for this problem.

Best regards,

LVL 16

Expert Comment

ID: 12296466
I feel the problem lies with the way a screen is captured.  Take, for example, the clipboard; it is my understanding that, when you choose to copy a window (with Alt+PrtSrc), it actually takes the top, left, width and height of the window and copies the entire screen within that rectangle to the clipboard.  If there is another window in front of it, that too will be within the rectangle and will be copied also.

If it is not viable for you to move/resize/zorder your form before doing a screen grab, I reckon some sort of print method may be your only option.  A brief Google search found a number of Print-to-Bitmap drivers, such as:


If you had this, you could set your default printer to this, run Form1.Printform and reset the default printer back to what it was.

I hope this helps at least a little bit


Author Comment

ID: 12303224
Dear jimbobmcgee:

Thanks for your comments and suggestions.

I am not sure I completely understand what you suggested. What if my code is compiled and installed in another computer, that computer also needs to install the printer driver you suggested?

I can not believe that nobody can come up with a better solution. Think about how Microsoft Powerpoint prints a file with multiple slides, which do not have to be seen on the screen and appears to be so easy......

I will wait a little bit more. If I can not get a better solution, I will give you the points. Appreciated a lot.

Best regards,

LVL 16

Accepted Solution

jimbobmcgee earned 2000 total points
ID: 12308145
>> What if my code is compiled and installed in another computer, that computer also needs to install the printer driver you suggested?

Unfortunately so.

>> Think about how Microsoft Powerpoint prints a file with multiple slides

Powerpoint prints its own files, which are stored in memory.  It can interpret and handle all the objects in all the slides in this file because a team of Microsoft developers wrote a print/export routine for each and every possible object Powerpoint could handle.

As I see it, you have a number of options for your forms:

1.  Install a print-to-bitmap driver and call the PrintForm method for each form (requires third-party software)

2.  Make the form you want to be a bitmap visible and size it so it fits on the screen, before running the routines suggested by
     shaival_trivedi (requires reformatting of the form)

3.  Write routines for every control on your form, translating what you see on screen to what you see in a bitmap, then iterate
     through all the controls on the form (requires lots of work)



Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question