James
Wed Oct 20 03:56:55 CDT 2004
Hi Jeffrey,
Thanks for your reply and information!
I got an article from MSDN talking about form print using VB.NET (no article
number on that article, the URL is
http://msdn.microsoft.com/library/cht/dv_vbcode/html/vbskcodeexampleprintingform.asp).
On the article, it also introduces BitBlt can handle the case. However, on
that article, the definition of BitBlt is
Private Declare Function BitBlt Lib "gdi32.dll" Alias "BitBlt" (ByVal _
hdcDest As IntPtr, ByVal nXDest As Integer, ByVal nYDest As _
Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal _
hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, _
ByVal dwRop As System.Int32) As Long
It is slightly different from the definition quoted on the article you
suggest:
private static extern bool BitBlt(
IntPtr hdcDest, // handle to destination DC
int nXDest, // x-coord of destination upper-left corner
int nYDest, // y-coord of destination upper-left corner
int nWidth, // width of destination rectangle
int nHeight, // height of destination rectangle
IntPtr hdcSrc, // handle to source DC
int nXSrc, // x-coordinate of source upper-left corner
int nYSrc, // y-coordinate of source upper-left corner
System.Int32 dwRop // raster operation code
);
Do they have same function except the languge?
Besides, the MSDN article also states that I should have the right to use
unmanaged code to run the example. I don't know how I konw if I have such
right, or how to get the right to do that. Moreover, I also don't know if
there is any drawback to open right to use unmanaged code.
Sorry for my long question and hope you can help me again!
Regards,
James Wong
""Jeffrey Tan[MSFT]"" <v-jetan@online.microsoft.com> ¦b¶l¥ó
news:5iCOetktEHA.3520@cpmsftngxa10.phx.gbl ¤¤¼¶¼g...
> Hi James,
>
> Thanks for your feedback!
>
> ControlPaint can only be used to draw common control, other customized
> control and graphics can not be drawed with this class. The article "How
> To: Printing Form Controls in C# and .NET" is on the assumption of we are
> the developer of the application, so we may provide a function to draw the
> lines and controls on the form to the printer Device Context.
>
> For your requirement of printing some third party control etc, because we
> are not the author of the control, we can not do the internal printing. We
> have to use the print screen way, that is copying every bit of the
> application to the printing DC.
>
> To copy every bit, we should p/invoke WIN32 API BitBlt, for more
> information, please refer to:
> "Screen Capturing a Form in .NET - Using GDI and GDI+"
>
http://www.c-sharpcorner.com/Graphics/ScreenCaptFormMG.asp
>
> Thank you for your patience and cooperation. If you have any questions or
> concerns, please feel free to post it in the group. I am standing by to be
> of assistance.
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>