Exemplo n.º 1
0
        public Form3(string usernanme, int m_num, bool m_state, bool m_positive, string m_IP_client, string m_name_client, int m_num_client, bool ACK)
        {
            InitializeComponent();
            myname          = usernanme;
            num             = m_num;
            state           = m_state;
            positive        = m_positive;
            IP_client       = m_IP_client;
            serverPort      = 8001 + 4 * num;
            serverPortFile  = 8002 + 4 * num;
            serverPortShake = 8003 + 4 * num;
            num_client      = m_num_client;
            name_client     = m_name_client;
            this.ACK        = ACK;
            label1.Text     = name_client;

            threadClient      = new Thread(P2PClient);
            threadServer      = new Thread(P2PServer);
            threadClientFile  = new Thread(P2PClientFile);
            threadServerFile  = new Thread(P2PServerFile);
            threadClientShake = new Thread(P2PClientShake);
            threadServerShake = new Thread(P2PServerShake);
            shake_hands();
            runServer();
            runServerFile();
            runShake();
            threadClient.IsBackground      = true;
            threadServer.IsBackground      = true;
            threadClientFile.IsBackground  = true;
            threadServerFile.IsBackground  = true;
            threadClientShake.IsBackground = true;
            threadServerShake.IsBackground = true;

            //发送表情
            imageList1            = new ImageList();
            imageList1.ImageSize  = new Size(24, 24);
            imageList1.ColorDepth = ColorDepth.Depth24Bit;                      //32位的带alpha通道的可以直接透明
            imageList1.Images.AddStrip(new Bitmap(GetType(), "emoticons.bmp")); //加载资源表情图片
            imageList1.TransparentColor = Color.FromArgb(255, 0, 255);

            ilp = new ImageListPopup();
            ilp.Init(imageList1, 8, 8, 10, 2);   //水平、垂直线间距,表情显示的列和行
            ilp.ItemClick += new ImageListPopupEventHandler(OnItemClicked);
        }
Exemplo n.º 2
0
        public MainForm()
        {
            InitializeComponent();
            Response res = new Response();

            this.webBrowserMessage.Navigate(new Uri(res.getHtmlMessage()));
            this.webBrowserMessage.ObjectForScripting = this;

            imageList            = new ImageList();
            imageList.ImageSize  = new Size(32, 32);
            imageList.ColorDepth = ColorDepth.Depth32Bit;                  //32位的带alpha通道的可以直接透明
            imageList.Images.AddStrip(new Bitmap(GetType(), "face2.bmp")); //加载资源表情图片

            ilp = new ImageListPopup();
            ilp.Init(imageList, 8, 8, 10, 2);   //水平、垂直线间距,表情显示的列和行
            ilp.ItemClick += new ImageListPopupEventHandler(OnItemClicked);

            this.buttonMin.BringToFront();
        }
Exemplo n.º 3
0
        private void buttonImageSelect_Click(object sender, EventArgs e)
        {
            if (this.imgPopup == null)
            {
                int n    = buttonImageSelect.ImageList.Images.Count;
                int x    = (int)Math.Floor(Math.Sqrt(n)) + 1;
                int cols = x;
                int rows = x;

                imgPopup = new ImageListPopup();
                imgPopup.BackgroundColor     = Color.FromArgb(241, 241, 241);
                imgPopup.BackgroundOverColor = Color.FromArgb(102, 154, 204);
                imgPopup.Init(this.buttonImageSelect.ImageList, 8, 8, cols, rows);
                imgPopup.ItemClick += new ImageListPopupEventHandler(this.OnItemClicked);
            }

            Point pt = PointToScreen(new Point(buttonImageSelect.Left, buttonImageSelect.Bottom));

            imgPopup.Show(pt.X + 2, pt.Y);
        }
Exemplo n.º 4
0
        private void buttonImageSelect_Click(object sender, EventArgs e)
        {
            if (this.imgPopup == null)
            {
                // TODO: ImageList is null on initial installation and will throw a nullreference exception when creating a new session and trying to select an image.

                int n    = buttonImageSelect.ImageList.Images.Count;
                int x    = (int)Math.Floor(Math.Sqrt(n)) + 1;
                int cols = x;
                int rows = x;

                imgPopup = new ImageListPopup();
                imgPopup.BackgroundColor     = Color.FromArgb(241, 241, 241);
                imgPopup.BackgroundOverColor = Color.FromArgb(102, 154, 204);
                imgPopup.Init(this.buttonImageSelect.ImageList, 8, 8, cols, rows);
                imgPopup.ItemClick += new ImageListPopupEventHandler(this.OnItemClicked);
            }

            Point pt = PointToScreen(new Point(buttonImageSelect.Left, buttonImageSelect.Bottom));

            imgPopup.Show(pt.X + 2, pt.Y);
        }