Exemple #1
0
        private void HandleMessage(Packet02Message messagePacket)
        {
            gameForm.Chat_textBox.Text += messagePacket.GetUsername() + " : " + messagePacket.GetMessage() + Environment.NewLine;
            int caretPos = gameForm.Chat_textBox.Text.Length;

            gameForm.Chat_textBox.Select(caretPos, 0);
            gameForm.Chat_textBox.ScrollToCaret();
        }
Exemple #2
0
        private void ChatSend_textBox_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                e.SuppressKeyPress = true;
                String message = ChatSend_textBox.Text;
                if (message.Length > 0)
                {
                    Packet02Message messagePacket = new Packet02Message(Form1.GetPlayerMP().username, message.Trim());
                    messagePacket.WriteData(Form1.GetGameClient());

                    ChatSend_textBox.Clear();

                    Chat_textBox.Text += messagePacket.GetUsername() + " : " + messagePacket.GetMessage() + Environment.NewLine;
                    int caretPos = Chat_textBox.Text.Length;
                    Chat_textBox.Select(caretPos, 0);
                    Chat_textBox.ScrollToCaret();
                }
            }
        }