How can I make my C ++ ActiveX print controls beautifully in Excel?

I am trying to get my ActiveX control to print well in Excel.

The control is written in C ++. Initially, I generated the control using the Visual Studio 2005 wizard. I tested it with a simple wizard created using the wizard to experiment with the OnDraw function, and I found that even the control directly from the wizard also does not print well. It appears to cut out most of the control, which by default displays a black outline and some text in the center.

The IDataObject_GetData function is called in my ActiveX control, which in turn creates a metafile and displays it.

Does anyone know how to get an ActiveX control to print? Alternatively, links to useful information will be appreciated.

+3
source share
1 answer

After a big scratch on my head, I figured out a solution to my problem.

The function OnDrawgenerated by the Visual Studio 2005 wizard configures the clipping region by invoking the function SelectClipRgn. It was this clipping setting that caused the ActiveX control to appear when printing. Commenting on the code, the ActiveX control prints fine. Commenting out the code also does not cause any other problems - at least in my case.

, , , DC.

, ActiveX:

http://www.codeproject.com/KB/COM/officeatlprint.aspx

http://www.codeproject.com/KB/COM/WirgerPrintArticle.aspx

http://support.microsoft.com/kb/81497

http://support.microsoft.com/kb/84984

+2

Source: https://habr.com/ru/post/1704274/


All Articles