以下代码可以截取窗口中的控件保存为图片:
Dim trv = e.Form.Controls("Treeview1").BaseControl
Dim point As Point = e.Form.Panel.PointToScreen(trv.Bounds.Location)
Dim myGraphics As Graphics = basemainform.CreateGraphics()
Dim s As new Size(trv.width, trv.height) '截取的大小
Dim bit As New Bitmap(s.Width, s.Height, myGraphics)
Dim memoryGraphics As Graphics = Graphics.FromImage(bit)
memoryGraphics.CopyFromScreen(point.x, point.y, 0, 0, s) '截取的开始位置,坐标(100, 200)
bit.save("d:\test.jpg")
memoryGraphics.dispose
myGraphics.dispose
bit.dispose
请教:我现在想截取当前表并保存图片?如何确定其“截取的开始位置”?
或者说,干脆给俺来个完整的代码,截取当前表全部或部分内容保存为图片。
谢谢!