| ||||
Respuesta: se puede imprimir un formlario? Hola que tal, en este link puse una respuesta haber si te sirve: http://www.forosdelweb.com/f29/impri...wsform-964109/ |
| |||
Respuesta: se puede imprimir un formlario? el código Cita: <System.Runtime.InteropServices.DllImport("gdi32.d ll")> _ Public Shared Function BitBlt(hdcDest As IntPtr, nXDest As Integer, nYDest As Integer, nWidth As Integer, nHeight As Integer, hdcSrc As IntPtr, _ nXSrc As Integer, nYSrc As Integer, dwRop As Integer) As Long End Function Private memoryImage As Bitmap Private Sub CaptureScreen() Dim mygraphics As Graphics = Me.CreateGraphics() Dim s As Size = Me.Size memoryImage = New Bitmap(s.Width, s.Height, mygraphics) Dim memoryGraphics As Graphics = Graphics.FromImage(memoryImage) Dim dc1 As IntPtr = mygraphics.GetHdc() Dim dc2 As IntPtr = memoryGraphics.GetHdc() BitBlt(dc2, 0, 0, Me.ClientRectangle.Width, Me.ClientRectangle.Height, dc1, _ 0, 0, 13369376) mygraphics.ReleaseHdc(dc1) memoryGraphics.ReleaseHdc(dc2) End Sub Private Sub printDocument1_PrintPage(sender As System.Object, e As System.Drawing.Printing.PrintPageEventArgs) e.Graphics.DrawImage(memoryImage, 0, 0) End Sub Private Sub printButton_Click(sender As System.Object, e As System.EventArgs) CaptureScreen() printPreviewDialog1.Show() End Sub |
Etiquetas: |