以文本方式查看主题 - Foxtable(狐表) (http://foxtable.com/bbs/index.asp) -- 专家坐堂 (http://foxtable.com/bbs/list.asp?boardid=2) ---- [求助]控件截图 (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=143276) |
||||
-- 作者:天一生水 -- 发布时间:2019/11/19 11:54:00 -- [求助]控件截图 老师好! 请老师帮助看一下,是哪里的问题? 谢谢!
代码如下:(不能复制,只好传图片)
[此贴子已经被作者于2019/11/19 11:55:12编辑过]
|
||||
-- 作者:有点蓝 -- 发布时间:2019/11/19 12:03:00 -- \'截取第一个页面 e.Form.Controls("TabControl1").SelectedIndex = 1 Application.Doevents Dim trv = e.Form.Controls("PictureBox1").BaseControl Dim point As Point = e.Form.controls("tabcontrol1").basecontrol.PointToScreen(trv.Bounds.Location) Dim myGraphics As Graphics = basemainform.CreateGraphics() Dim s As new Size(trv.width-20, trv.height-60) \'截取的大小 Dim bit As New Bitmap(s.Width, s.Height , myGraphics) Dim memoryGraphics As Graphics = Graphics.FromImage(bit) memoryGraphics.CopyFromScreen(point.x+4, point.y+55, 0, 0, s) \'截取的开始位置,坐标(100, 200) bit.save(ProjectPath & "Attachments\\图片\\" & "TM" & ".jpg") memoryGraphics.dispose myGraphics.dispose bit.dispose \'截取第二个页面 e.Form.Controls("TabControl1").SelectedIndex = 0 Application.Doevents Dim trv1 = e.Form.Controls("PictureBox2").BaseControl Dim point1 As Point = e.Form.controls("tabcontrol1").basecontrol.PointToScreen(trv1.Bounds.Location) Dim myGraphics1 As Graphics = basemainform.CreateGraphics() Dim s1 As new Size(trv1.width-20, trv1.height-60) \'截取的大小 Dim bit1 As New Bitmap(s1.Width, s1.Height , myGraphics1) Dim memoryGraphics1 As Graphics = Graphics.FromImage(bit1) memoryGraphics1.CopyFromScreen(point.x+4, point.y+55, 0, 0, s1) \'截取的开始位置,坐标(100, 200) bit1.save(ProjectPath & "Attachments\\图片\\" & "DA" & ".jpg") memoryGraphics1.dispose myGraphics1.dispose bit1.dispose msgbox("答案已保存!") |
||||
-- 作者:天一生水 -- 发布时间:2019/11/27 10:54:00 -- 蓝老师好! 页签中的PictureBox控件换成WebBrowser就不行了,如果起始页签是2,3,4,截图也不对,是什么原因? 实例中双击窗口中的行,调出截图窗口。 谢谢!
\'代码如下: End With msgbox("已保存!")
|
||||
-- 作者:有点蓝 -- 发布时间:2019/11/27 11:21:00 -- …… bit.dispose Forms("错题数据").Controls("PictureBox1").ImageFile = "" Forms("错题数据").Controls("PictureBox1").ImageFile = ProjectPath & "Attachments\\错题\\" & Tables("错题数据_table1").Current("编号") & "TM" & ".jpg" Application.Doevents e.Form.Controls("TabControl1").SelectedIndex = 0 Application.Doevents Dim trv1 = e.Form.Controls("WebBrowser2").BaseControl ……
|
||||
-- 作者:天一生水 -- 发布时间:2019/11/27 12:17:00 -- 蓝老师好! 经测试,连续点击保存15次,再点击保存5次......截的“题目”和“答案”的图相同; 另外,起始页面在“笔记感悟”、“识别信息”、“文本信息”时,“题目”的截图都是起始页面控件的图,不是“题目”页面的图。 |
||||
-- 作者:有点蓝 -- 发布时间:2019/11/27 13:39:00 -- 我测试没有问题,不行就等待几秒秒后再截第二个 ……
bit.dispose Forms("错题数据").Controls("PictureBox1").ImageFile = "" Forms("错题数据").Controls("PictureBox1").ImageFile = ProjectPath & "Attachments\\错题\\" & Tables("错题数据_table1").Current("编号") & "TM" & ".jpg" Dim sdt As Date = Date.Now While Date.Now < sdt.AddSeconds(2) Application.DoEvents End While e.Form.Controls("TabControl1").SelectedIndex = 0 Application.Doevents Dim trv1 = e.Form.Controls("WebBrowser2").BaseControl …… |