以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  窗口中的目录树如何打印出来  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=135159)

--  作者:有点甜
--  发布时间:2019/5/19 15:22:00
--  

方法一:

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

 


--  作者:有点甜
--  发布时间:2019/5/19 15:23:00
--  

方法二:

Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
Dim doc As New PrintDoc \'定义一个报表
For Each nd As WinForm.TreeNode In trv.AllNodes
    Dim rt As New prt.RenderText \'定义一个文本对象
    rt.Text = "".PadLeft(nd.Level * 8) & nd.Text
    doc.Body.Children.Add(rt) \'将文本对象加入到报表
Next
doc.Preview() \'预览


 

http://www.foxtable.com/webhelp/scr/2450.htm