When you host a Windows Forms control on a Web page in
Internet Explorer, the control renders and displays properly. However, when you
print or print preview the page, the control does not appear at all.
Note This problem does not occur with unmanaged ActiveX controls.
↑ Back to the top
To print a form or a control, a .NET application renders
the content to a bitmap and then prints the bitmap. However, when Internet
Explorer tries to print an HTML page, it first renders the page to a metafile
and then prints the metafile. This problem occurs in Internet Explorer because
Graphics Device Interface (GDI) has some limitation in printing to a metafile
device context.
↑ Back to the top
Microsoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
↑ Back to the top
Steps to Reproduce the Problem
- Create a .NET Windows Form control.
- Add the control in an HTML page with the <OBJECT>
tag. For example:
<OBJECT id="anyid" classid="component-name.dll#namespace-path.control-name"></OBJECT>
- Open the HTML page in Internet Explorer. Notice that you
can see your control in Internet Explorer.
- Click Print Preview on the
File menu. Notice that the control does not appear.
- Click Print on the File
menu. Notice that the printed document does not include the control.
↑ Back to the top
For more information about hosting secure, lightweight,
client-side controls in Internet Explorer, visit the following Microsoft
Developer Network (MSDN) Web site:
↑ Back to the top