Beispiel #1
0
 void prop_ItemClick(object sender, ImageListPopupEventArgs ilpea)
 {
     if (sender.Equals(prop))
     {
         MsgBox.Alert(ilpea.SelectedItem);
     }
 }
Beispiel #2
0
 private void OnItemClicked(object sender, ImageListPopupEventArgs e)
 {
     if (imgPopup == sender)
     {
         buttonImageSelect.ImageKey = e.SelectedItem;
         this.toolTip.SetToolTip(this.buttonImageSelect, buttonImageSelect.ImageKey);
     }
 }
Beispiel #3
0
                /**/
                ///接受到client连接,为此连接建立新的socket,并接受信息
                Socket temp      = s.Accept(); //为新建连接创建新的socket
                string recvStr   = "";         //order+ACK" + "+" + m_num.ToString()
                byte[] recvBytes = new byte[1024];
                int    bytes;
                bytes    = temp.Receive(recvBytes, recvBytes.Length, 0);//从客户端接受信息
                recvStr += Encoding.UTF8.GetString(recvBytes, 0, bytes);
                string[] str = recvStr.Split(new Char[] { '+' });
                if (str[1] == "ACK")
                {
                    num_client      = int.Parse(str[2]);
                    clientPort      = 8001 + 4 * num_client;
                    clientPortFile  = 8002 + 4 * num_client;
                    clientPortShake = 8003 + 4 * num_client;
                    isConnect       = true;
                    temp.Close();
                    s.Close();
                }
                else
                {
                    MessageBox.Show("对方不同意您的会话请求,连接失败!", "会话请求", MessageBoxButtons.OK);
                    Frmcnct.reply = false;
                    isConnect     = false;
                }
            }
        }

        void runShake()
        {
            string stringState = threadServerShake.ThreadState.ToString();

            switch (stringState)
            {
            case "Unstarted":     //第一次启动
                try
                {
                    threadServerShake.Start();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                break;

            case "Running":        //正在运行,此状态删掉亦可
                break;

            case "Suspended":     //挂起则恢复运行
                break;

            case "Stopped":     //线程已停止则重新启动
                threadServerShake = new Thread(P2PServerShake);
                threadServerShake.Start();
                break;

            default:     //什么都不做
                break;
            }
        }

        /************************************************************************/
        /* 选择了表情                                                                                          */
        /************************************************************************/
        public void OnItemClicked(object sender, ImageListPopupEventArgs e)
        {
            Image img = imageList1.Images[e.SelectedItem];

            Clipboard.SetDataObject(img);
            richTextBox2.ReadOnly = false;
            richTextBox2.Paste(DataFormats.GetFormat(DataFormats.Bitmap));
        }
 private void OnItemClicked(object sender, ImageListPopupEventArgs e)
 {
     if (imgPopup == sender)
     {
         buttonImageSelect.ImageKey = e.SelectedItem;
         this.toolTip.SetToolTip(this.buttonImageSelect, buttonImageSelect.ImageKey);
     }
 }