私は他の場所で試しましたが、何も起こりませんでした。基本的に、画像をピクチャボックスに表示したい。
私のコード:
Dim ScreenReceiverClient As New TcpClient
Dim ScreenReceiverServer As New TcpListener(ScreenReceiverPort)
Dim ScreenReceiverListening As New Thread(AddressOf ScreenListen)
Dim GetScreen As New Thread(AddressOf ReceiveScreen)
Private Sub ReceiveScreen()
While ScreenReceiverClient.Connected = True
Call New Action(AddressOf ChangeImage).BeginInvoke(Nothing, Nothing)
End While
End Sub
Private Sub ChangeImage()
Dim bf As New BinaryFormatter
PictureBox1.Image = bf.Deserialize(ScreenReceiverClient.GetStream)
End Sub
Private Sub ScreenListen()
While ScreenReceiverClient.Connected = False
ScreenReceiverServer.Start()
ScreenReceiverClient = ScreenReceiverServer.AcceptTcpClient
End While
GetScreen.Start()
End Sub
ChangeImage() は、ScreenReceiverListening スレッドではなく UI スレッドで呼び出されるはずですが、UI がフリーズするだけです。私を助けてください!