Print a particular area (component)
Have an VB application created using VB6. A p开发者_高级运维art of the application shows flash inside.
When I use printform
it just prints the whole application. I dont know how to print the flash part alone. Any help would be appreciated!..
Thanks.
VB's .PrintForm
method is extremely limited and only does "print the entire client area", so you can't use it to print a specific control without it filling the entire form..
If you just want to print the flash control, check its interface to see if it offers any printing support, or look at code that takes a screenshot of the appropriate control and printing that use the normal Printer
object.
When i faced similar kind of problem I Used several frame to hold control.Before printing i made some frames hidden that don't need to be printed.Then calling printForm.And after calling showed the hidden frames again
Here is some code from the excellent VBHelper site
This uses the keybd_event
API function to simulate pressing Alt-PrntScrn to place an image of the form in the clipboard. It pastes the image into a hidden PictureBox. Then it determines where inside the image the target control lies and uses PaintPicture to copy that part of the image to the Printer object.
Not neat, but it might get the job done for you.
精彩评论