回复 6楼 不说也罢
版主,你用的是什么控件?可以分享吗?
'打印PictureBox区域,需要在窗体上添加一个PrintDocument1 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 Dim memoryImage As Bitmap Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim mygraphics As Graphics = PictureBox1.CreateGraphics Dim s As Size = PictureBox1.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, PictureBox1.ClientRectangle.Width, _ PictureBox1.ClientRectangle.Height, dc1, 0, 0, 13369376) mygraphics.ReleaseHdc(dc1) memoryGraphics.ReleaseHdc(dc2) PrintDocument1.Print() End Sub Private Sub PrintDocument1_PrintPage(ByVal sender As System.Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles PrintDocument1.PrintPage e.Graphics.DrawImage(memoryImage, 0, 0, PictureBox1.ClientRectangle.Width, _ PictureBox1.ClientRectangle.Height) End Sub