Beispiel #1
0
        private void  除此条信息ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            UCMessageHistory uc = (UCMessageHistory)currentRight;

            BLL.messsageInfo bll = new BLL.messsageInfo();
            int mid = uc.Ucid;

            bll.Delete(mid);
            getmessage();
        }
Beispiel #2
0
        private void getmessage()
        {
            this.Width = 640;


            this.pnHistory.Controls.Clear();
            this.pnHistory.Visible = true;
            BLL.messsageInfo          bllmess = new BLL.messsageInfo();
            List <Model.messsageInfo> lmess   = bllmess.GetModelList("receiverID='" + this._friend.userID + "'or senderID='" + this._friend.userID + "'");
            int index = 0;

            foreach (Model.messsageInfo mess in lmess)
            {
                BLL.userInfo     blluser  = new BLL.userInfo();
                Model.userInfo   username = blluser.GetModel(mess.senderID);
                UCMessageHistory uc       = new UCMessageHistory();
                if (mess.receiverID == this._friend.userID)
                {
                    uc.Ucid        = mess.messageID;
                    uc.Top         = uc.Height * index;
                    uc.Username    = username.userName;
                    uc.Time        = mess.sendTime;
                    uc.Message     = mess.messageContent;
                    uc.BackColor   = Color.Beige;
                    uc.Me          = false;
                    uc.IsChosed    = false;
                    uc.MouseClick += new MouseEventHandler(uc_MouseClick);
                    listmessage.Add(uc);
                    chouseed.Add(uc);
                    uc.MouseMove += new MouseEventHandler(uc_MouseMove);
                    pnHistory.Controls.Add(uc);
                    index++;
                }
                else
                {
                    uc.Ucid      = mess.messageID;
                    uc.Top       = uc.Height * index;
                    uc.Username  = username.userName;
                    uc.Time      = mess.sendTime;
                    uc.Message   = mess.messageContent;
                    uc.BackColor = Color.Beige;
                    uc.Me        = true;
                    uc.IsChosed  = false;
                    listmessage.Add(uc);
                    chouseed.Add(uc);
                    uc.MouseMove  += new MouseEventHandler(uc_MouseMove);
                    uc.MouseClick += new MouseEventHandler(uc_MouseClick);
                    pnHistory.Controls.Add(uc);
                    index++;
                }
            }
        }
Beispiel #3
0
        void uc_MouseClick(object sender, MouseEventArgs e)
        {
            currentRight = (UCMessageHistory)sender;
            if ((Control.ModifierKeys & Keys.Control) == Keys.Control)
            {
                if (currentRight.IsChosed == false)
                {
                    currentRight.IsChosed  = true;
                    currentRight.BackColor = Color.Red;
                }
                else
                {
                    currentRight.IsChosed  = false;
                    currentRight.BackColor = Color.Beige;
                }
            }
            if (e.Button != System.Windows.Forms.MouseButtons.Right)
            {
                return;
            }

            this.contextMenuStrip1.Show(Control.MousePosition);
        }