以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  控件截图  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=127208)

--  作者:yangwenghd
--  发布时间:2018/11/8 14:41:00
--  控件截图

控件截图,能帮忙看看吗?

如果窗口没有TabControl1控件怎么改一下这个代码啊,感谢 感谢 

[此贴子已经被作者于2018/11/8 14:48:35编辑过]

--  作者:有点甜
--  发布时间:2018/11/8 14:44:00
--  

1、代码发出来;

 

2、实例发上来,说明你要做什么。


--  作者:yangwenghd
--  发布时间:2018/11/8 14:50:00
--  

我现在正在和太后沟通,案例上不上来,附件添加不能上传,代码复制到上面也不能发表,不知道为什么

如果窗口没有TabControl1控件怎么改一下这个代码啊,感谢 感谢 


Dim myGraphics As Graphics = basemainform.CreateGraphics()
Dim tb As WinForm.TabControl = e.Form.Controls("TabControl1")
Dim s As size
Dim pl As WinForm.Panel
If tb.SelectedPage.Text="图片方式" Then
    pl=e.Form.Controls("Panel1")
    s= new Size(pl.Width ,pl.Height)
\'Else If tb.SelectedPage.Text="表格方式" Then
    \'pl=e.Form.Controls("Panel2")
    \'s= new Size(pl.Width ,pl.Height)
End If
 
怎么把TabControl1部分去掉吗?
[此贴子已经被作者于2018/11/8 14:51:50编辑过]

--  作者:有点甜
--  发布时间:2018/11/8 14:54:00
--  
Dim myGraphics As Graphics = basemainform.CreateGraphics()
Dim s As size
Dim pl As WinForm.Panel
pl=e.Form.Controls("Panel1")
s= new Size(pl.Width ,pl.Height)

--  作者:yangwenghd
--  发布时间:2018/11/12 14:18:00
--  

 下载信息  [文件大小:   下载次数: ]
图片点击可在新窗口打开查看点击浏览该文件:截图位置.txt


老师,能请教一下怎么定位截图的位置和大小啊,感谢 感谢 

--  作者:有点甜
--  发布时间:2018/11/12 14:26: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


 

看懂代码改成自己的。不会做上传实例说明你要做什么。

[此贴子已经被作者于2018/11/12 14:26:02编辑过]

--  作者:yangwenghd
--  发布时间:2018/11/19 12:15:00
--  
老师 我这个能改为另存为吗?
然后另存为 默认的名称可以是DateTimePicker1显示的吗?
Dim trv = e.Form.Controls("Panel3").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, 00, -30, s) \'截取的开始位置,坐标(100, 200)
\'bit.save(Tables("库存").Current("属性_图片文件夹") & "\\DateTimePicker1.PNG" )
\'msgbox("截图成功")
memoryGraphics.dispose
myGraphics.dispose
bit.dispose

--  作者:有点甜
--  发布时间:2018/11/19 12:24:00
--  

比如

 

bit.save(Tables("库存").Current("属性_图片文件夹") & "\\" & e.form.controls("DateTimePicker1").text & ".PNG")


--  作者:xndd
--  发布时间:2018/11/19 12:31:00
--  
换浏览器支持IE的就行