DOCUMENT:Q184675 27-APR-1998 [vbwin] TITLE :BUG: PictureBox Prints Incorrectly with PrintForm PRODUCT :Microsoft Visual Basic for Windows PROD/VER:WINDOWS:5.0 OPER/SYS:WINDOWS KEYWORDS:kbnokeyword ====================================================================== --------------------------------------------------------------------- The information in this article applies to: - Microsoft Visual Basic Learning, Professional, and Enterprise Editions for Windows, version 5.0 --------------------------------------------------------------------- SYMPTOMS ======== When you print a form from the IDE or you use the PrintForm method to print a form containing a PictureBox with its Picture property set to a metafile (.wmf, .emf), the picture in the PictureBox does not print correctly. The picture may appear offset from its original location or may not appear at all. CAUSE ===== The greater the Top and Left properties of the PictureBox control are from (0,0), the greater the offset of the actual picture in the printed output. The actual offset of the picture is relative to the size of the form. RESOLUTION ========== The following are three different methods you can use to work around this problem: - Use an Image control rather than a PictureBox control. - Set the Picture property of the PictureBox control to a file in another graphics format. In addition to metafiles, the Picture property for a PictureBox also supports the bitmap (.bmp), icon (.ico), GIF, and JPEG file formats. - Use another technique to print the form instead of the PrintForm method. The following articles in the Microsoft Knowledge Base discuss techniques you can implement to print your form with Visual Basic: ARTICLE-ID: Q161299 TITLE : HOWTO: Capture and Print the Screen, a Form, or any Window ARTICLE-ID: Q178076 TITLE : HOWTO: Use a PictureBox to Control Orientation Printing a Form STATUS ====== Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this bug and will post new information here in the Microsoft Knowledge Base as it becomes available. MORE INFORMATION ================ Steps to Reproduce Behavior --------------------------- 1. Start a new project in Visual Basic. 2. Draw a PictureBox control in the upper-left corner of Form1. Set the Picture property to any metafile. NOTE: You can find some metafiles in the Graphics\Metafile of your Visual Basic directory. 3. Add the following code to the Click event of Form1: PrintForm Picture1.Move 2000 PrintForm 4. Press F5 to run the project. 5. Click Form1. RESULTS: Notice that the first PrintForm prints the image correctly. However, the second PrintForm, which executes after the Picture control is moved, prints the image incorrectly. Depending on the picture you selected, and the size of the form, the picture may appear off-center or not appear at all. Additional query words: move left top meta file picture box ====================================================================== Keywords : kbnokeyword Version : WINDOWS:5.0 Platform : WINDOWS Issue type : kbbug ============================================================================= THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY. Copyright Microsoft Corporation 1998.