formsendmsggroup.cs

来自「kuiMsg是一款用.net C# 开发的即时消息开源软件,适合.net即时消息」· CS 代码 · 共 75 行

CS
75
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace LanMsg 
{
    public partial class FormSendMsgGroup : DevComponents .DotNetBar.Office2007Form // Form
    {
        public FormSendMsgGroup()
        {
            InitializeComponent();
            this.cBoxMsgInfo.SelectedIndex=0;
        }

        private void FormSendMsgGroup_Load(object sender, EventArgs e)
        {
            FormAccess.formMain.TreeUsers.CheckBoxes = true;
        }

        private void butSend_Click(object sender, EventArgs e)
        {
            if (this.RTBSendContent.Text.Trim() == "")
            {
                MessageBox.Show("不能发送空消息。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }
            dataAccess.addMsgToDB(this.RTBSendContent.Text.TrimEnd(), FormAccess.selfInfo.UserID ,"", "1", System.DateTime.Now.ToString(), "", false);
            IMLibrary.clientMsg  msg=new IMLibrary.clientMsg(this.RTBSendContent.Text.TrimEnd(),FormAccess.selfInfo.UserID );
            FormAccess.sendMsgToAllCheckUser(15, IMLibrary.Serializers.ObjToByte(msg));
            MessageBox.Show("消息已经发送。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            this.RTBSendContent.Clear();
            this.Close();
            this.Dispose();
        }

        private void contextMenuStrip1_Opening(object sender, CancelEventArgs e)
        {
            bool t = true;

            if (this.RTBSendContent.SelectedText.Length == 0)
                t = false;

            this.MenuItemCopy.Visible = t;
            this.MenuItemCut.Visible = t;
            this.MenuItemDel.Visible = t;
        }

        private void contextMenuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            switch (e.ClickedItem.Name)
            {
                case "MenuItemCopy":
                    this.RTBSendContent.Copy();
                    break;
                case "MenuItemPaset":
                    this.RTBSendContent.Paste();
                    break;
                case "MenuItemCut":
                    this.RTBSendContent.Cut();
                    break;
                case "MenuItemDel":
                    this.RTBSendContent.SelectedText = "";
                    break;
                case "MenuItemSelAll":
                    this.Focus();
                    this.RTBSendContent.SelectAll();
                    break;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?