Foxtable(狐表)用户栏目专家坐堂 → [求助]请教,有没有办法把目录树导出为一个图片或其他可见的文件


  共有2708人关注过本帖树形打印复制链接

主题:[求助]请教,有没有办法把目录树导出为一个图片或其他可见的文件

帅哥哟,离线,有人找我吗?
有点色
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/4/23 16:56: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

 

[此贴子已经被作者于2017/4/23 16:56:20编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/4/23 20:54: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")

bit.dispose

[此贴子已经被作者于2017/5/23 18:10:10编辑过]

 回到顶部
帅哥哟,离线,有人找我吗?
有点色
  3楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:超级版主 帖子:13837 积分:69650 威望:0 精华:0 注册:2016/11/1 14:42:00
  发帖心情 Post By:2017/5/23 18:10: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

[此贴子已经被作者于2017/5/23 18:11:58编辑过]

 回到顶部