示例#1
0
        public void SendCapture(Bitmap C_Image, int Pos)
        {
            MemoryStream ms = new MemoryStream();

            C_Image.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
            ms.Position = 0;
            Byte[] SendBytes = new Byte[(int)ms.Length];
            ms.Read(SendBytes, 0, SendBytes.Length);
            ImageClient.Send(BitConverter.GetBytes(SendBytes.Length));
            ImageClient.Send(BitConverter.GetBytes(Pos));
            ImageClient.Send(SendBytes);
        }
示例#2
0
        private void GrabImageAndSend()
        {
            ImageClient.OpenConnection();
            Capture = new VideoCapture();
            var frame = new Mat();

            Capture.ImageGrabbed += (s, ex) =>
            {
                Capture.Read(frame);
                ImageClient.Send(frame.Bitmap);
            };
            Capture.Start();
        }
示例#3
0
        private void SendImageButton_Click(object sender, EventArgs e)
        {
            Bitmap ImageBit = (Bitmap)ImagePictureBox.Image;

            byte[]       ImageByte;
            Image        GetImageBit = ImagePictureBox.Image;
            MemoryStream ms          = new MemoryStream();

            ImageBit.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
            //GetImageBit.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp);
            ms.Position = 0;
            ImageByte   = new byte[(int)ms.Length];
            ms.Read(ImageByte, 0, (int)ms.Length);
            int L = (int)ms.Length;

            ChatBox.Items.Add(L.ToString());
            ImageClient.Send(BitConverter.GetBytes(ImageByte.Length), 0, 4, SocketFlags.None);
            ImageClient.Send(ImageByte);
            Thread.Sleep(200);
        }