Knowledge Base

BUG: PictureBox Prints Incorrectly with PrintForm

Article ID: 184675

Article Last Modified on 11/18/2003


APPLIES TO


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:

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. Form1 is created by default.
  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 the F5 key 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 kbPrinting kbVBp500 kbVBp

Keywords: kbbug KB184675