You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tcpipSocket/Chat/Client/ChatRoomForm.cs

38 lines
666 B

2 years ago
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Client
{
public partial class ChatRoomForm : Form
{
public ChatRoomForm()
{
InitializeComponent();
}
private void btmSend_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(tbxMsg.Text))
return;
lbxMsg.Items.Add(tbxMsg.Text);
tbxMsg.Text = null;
ScrollMsgToEnd();
}
private void ScrollMsgToEnd()
{
lbxMsg.SelectedIndex = lbxMsg.Items.Count - 1;
lbxMsg.SelectedIndex = -1;
}
}
}