Chat app - send Font color
I have been working on a app and currently have got it working the user can set there font color so i want when the user sends the text it also send the color as well
heres the code i use to collor the text
vb Code:
Private Sub DisplayT(ByVal text As String)
Dim sto As String
sto = "You say: "
Dim selectionStart As Integer = txtDisplay.TextLength
txtDisplay.AppendText(sto)
txtDisplay.SelectionStart = selectionStart
txtDisplay.SelectionLength = sto.Length
txtDisplay.SelectionColor = Color.Green
stoco(text)
End Sub
Sub stoco(ByVal text As String)
Dim selectionStart As Integer = txtDisplay.TextLength
txtDisplay.AppendText(text)
txtDisplay.SelectionStart = selectionStart
txtDisplay.SelectionLength = text.Length
txtDisplay.SelectionColor = txtSend.ForeColor
txtDisplay.AppendText(Environment.NewLine)
End Sub
and heres the code i use to send the text to the server
vb Code:
If txtSend.Text <> "" Then
DisplayT(txtSend.Text)
SendData("CHAT|" & txtSend.Text)
txtSend.Text = ""
End If
vb Code:
Public Sub SendData(ByVal data As String)
Dim writer2 As New IO.StreamWriter(client.GetStream)
writer2.Write(data & vbCr)
writer2.Flush()
End Sub
Re: Chat app - send Font color
Just send a code (a number) that represents the font colour and have the client side read that before it shows the message and then it can set the relevant font colour.
So instead of sending CHAT|MessageHere you might send CHAT|10|MessageHere where 10 would represent a colour. There might be a better way of doing it but thats the only way I can think of.
Re: Chat app - send Font color
there is only one issue there they can pick any color and also set there own custom colors so i would need to set a number for every color OR restict the colors they can pick From
Re: Chat app - send Font color
Use the ColorDialog control and just set the color to whatever has been selected from that.
Much easier...
Re: Chat app - send Font color
thats what im doing but when happens in the user selects there font color and then when the user hit send it shows up in that color on the other users screens