Foxtable(狐表)用户栏目专家坐堂 → 请教受控文件章的问题


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

主题:请教受控文件章的问题

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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/6/3 18:47:00 [显示全部帖子]

方法一:可以截图,如

 

Dim trv = e.Form.Controls("picturebox1").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

Dim Proc As New Process '定义一个新的Process
Proc.File = "d:\test.jpg"   '指定要打开的文件
Proc.Start() '打开文件


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


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2019/6/3 18:54:00 [显示全部帖子]

方法二:直接绘制进去

 

Dim imgback As image = e.Form.controls("picturebox1").image
Dim bmp As new bitmap(imgback.width, imgback.height)
Dim g = graphics.fromimage(bmp)
g.DrawImage(imgback, 0, 0, imgback.Width, imgback.Height)

Dim lbl1 As WinForm.Label = e.Form.controls("label1")
Dim msg As String = lbl1.Text
Dim fnt As font = lbl1.Font
g.DrawString(msg,fnt,New SolidBrush(lbl1.ForeColor), lbl1.Left, lbl1.Top)

bmp.save("d:\test.jpg")
bmp.dispose

Dim Proc As New Process '定义一个新的Process
Proc.File = "d:\test.jpg"   '指定要打开的文件
Proc.Start() '打开文件


 回到顶部