I'm making a multithreaded client server program, and on the server side I have a MDI form where I want to draw on the client area of the form the connection status of all clients.
I added a picture box in the MDI, with the Visible = False, I paint on the picturebox what I need, then I set the picture's Image to the MDI form Picture (see code).
The problem is that after I do that, there is no method for MDI do refresh the form !![]()
I'm using the following code:
VB Code:
Private Sub CConnection_StateChanged(Index As Integer, ByVal NewSckState As Integer) Dim TmpStr As String, K As Long, TextHeight As Single Debug.Print "CConnection_StateChanged: " & Index, NewSckState picDrawClientState.Cls picDrawClientState.AutoRedraw = True For K = 0 To CConnection.UBound With picDrawClientState .CurrentX = 25 .CurrentY = K * TextHeight + 50 picDrawClientState.Print K If K = 0 Then TextHeight = .CurrentY - 50 .CurrentX = 500 .CurrentY = K * TextHeight + 50 TmpStr = Choose(CConnection(K).ClientState + 1, _ "Closed", "Open", "Listening", "Connection pending", _ "Resolving host", "Host resolved", "Connecting", _ "Connected", "Disconnecting", "Error") picDrawClientState.Print TmpStr picDrawClientState.Line (0, .CurrentY)-(5000, .CurrentY) End With Next K picDrawClientState.Line (450, 0)-(450, 10000) Set frmMain.Picture = picDrawClientState.Image ' HAVE TO REDRAW THE MDI HERE !!! End Sub
Thanks in advance...




Reply With Quote