在我的聊天室 MessageBox 中实现表情符号
我想知道如何在与其他人/朋友交谈时在聊天室中实现表情符号。
这是我必须发送的消息:(聊天客户端的表单)
private Image smiley = Image.FromFile(Application.StartupPath.ToString() + "\\Smiles\\ConfusedSmiley.png");
private void SendMsg_Click(object sender, EventArgs e)
{
if (WriteMsg.Text != "")
{
int _index;
_index = WriteMsg.Find(":S");
if (_index != -1)
{
WriteMsg.Select(_index, ":S".Length);
WriteMsg.InsertImage(smiley);
}
mConnection.SendMessage(".msg : " + WriteMsg.Text);
WriteMsg.Text = "";
}
}
这是我与流输出的连接:
public void SendMessage(string Msg)
{
Console.WriteLine(">>"+Msg);
Outgoing.WriteLine(Msg);
Outgoing.Flush();
}
现在,如您所见,在我的聊天表单的“SendMsg_Click”中,我有应该发送的图像类型当你输入 :S 时,它所做的只是发送空文本,没有图像。我目前正在使用 Khendys.Controls“ExRichTextBox”来尝试使图像正常工作。现在,我的另一个问题是,我是否需要向服务器客户端添加相同的内容?如果我只通过聊天客户端执行此操作,那么它可能也必须在服务器客户端中,这就是我所说的。
I am wondering how could I implement emoticons in my chat room whilst I talk to other people/Friends.
Here is what I have to send my message out:(Chat Client's Form)
private Image smiley = Image.FromFile(Application.StartupPath.ToString() + "\\Smiles\\ConfusedSmiley.png");
private void SendMsg_Click(object sender, EventArgs e)
{
if (WriteMsg.Text != "")
{
int _index;
_index = WriteMsg.Find(":S");
if (_index != -1)
{
WriteMsg.Select(_index, ":S".Length);
WriteMsg.InsertImage(smiley);
}
mConnection.SendMessage(".msg : " + WriteMsg.Text);
WriteMsg.Text = "";
}
}
This is my connection with the Stream output:
public void SendMessage(string Msg)
{
Console.WriteLine(">>"+Msg);
Outgoing.WriteLine(Msg);
Outgoing.Flush();
}
Now, as you can see, in my Chat Form's "SendMsg_Click", I have the type of image that should be sent when you type :S, well, all it does is send empty text, no image. I am currently using, Khendys.Controls "ExRichTextBox" to try and get the images working. Now, my other question is, do I need to add the same thing to the Server Client? If I only do it through the chat client, it would probably have to be in the server client as well is what I'm saying.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当消息中使用图像(表情符号)时,您无需发送它们。您应该在客户端和服务器中拥有相同的图像集。假设您从客户端发送:),那么,在服务器端您需要将字符串替换为本地图像(表情符号),反之亦然。
You need not to send the image (emotiocons) when they are used in the message. You should have the same set of images in client as well as server. Suppose you send from client :), then, in server side you need to replace the string with the local image (emoticon) same apply in the reverse.