只需查看客户端桌面的dotnet代码 [英] dotnet code to just view the client desktop

查看:80
本文介绍了只需查看客户端桌面的dotnet代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的所有人,

我尝试了逐行调试,但显示错误.

Dear all,

I tried debugging line by line, but it''s showing an error.

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

   Dim liveclient As New TcpClient(selectedclientip, 2000)
   Dim bytes() As Byte
   ''bytes = Encoding.ASCII.GetBytes(treeviewselected)
   bytes = Encoding.ASCII.GetBytes("live")
   MsgBox("call from server.......")

   PictureBox1.Image = Nothing
   ''Dim liveclient As New TcpClient("127.0.0.1", 2000)
   ''Dim liveclient As New TcpClient(selectedclientip, 2000)
   Dim networkstream As NetworkStream = liveclient.GetStream
   networkstream.Write(bytes, 0, bytes.Length)
   MsgBox("" & networkstream.CanRead)
   Dim datelive As String
   Dim filename As String
   Dim bw As BinaryWriter
   Dim fs As FileStream
   Dim f As FileStream
   filename = "c:\\livescreen.bmp"
   fs = New FileStream(filename, FileMode.Create, FileAccess.Write)
   bw = New BinaryWriter(fs)
   Dim rawdata() As Byte = New Byte(1288477) {}
   While Not networkstream.CanRead Or Not networkstream.DataAvailable
      MsgBox("no data on the stream")
   End While
   networkstream.Read(rawdata, 0, rawdata.Length())
   bw.Write(rawdata)
   MsgBox("image saved")

   fs.Close()
   bw.Close()
   filename = "c:\\livescreen.bmp"
   f = New FileStream(filename, FileMode.Open, FileAccess.Read)
   PictureBox1.Image = Image.FromStream(f)  ''<------- ERROR HERE
   f.Close()
   Me.Refresh()
End Sub



[edit]代码块,格式-OriginalGriff [/edit]



[edit]Code Block, formatting - OriginalGriff[/edit]

推荐答案

尝试一下

PictureBox1.Image = Image.FromStream(FS,False,False)------>代替

PictureBox1.Image = Image.FromStream(f)''< -------此处错误
Try this

PictureBox1.Image = Image.FromStream(FS, False, False) ------> instead of

PictureBox1.Image = Image.FromStream(f) ''<------- ERROR HERE


这篇关于只需查看客户端桌面的dotnet代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆