BUG: PictureBox Prints Incorrectly with PrintForm
Article ID: 184675
Article Last Modified on 11/18/2003
APPLIES TO
- Microsoft Visual Basic 5.0 Learning Edition
- Microsoft Visual Basic 5.0 Professional Edition
- Microsoft Visual Basic 5.0 Enterprise Edition
This article was previously published under Q184675
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:
161299
: HOWTO: Capture and Print the Screen, a Form, or any Window
178076
: 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.
Additional query words: move left top meta file picture box kbPrinting kbVBp500 kbVBp
Keywords: kbbug KB184675