Example #1
0
        /**显示线程*/
        private void dispalyBitmapFun()
        {
            while (isConnect)
            {
                try
                {
                    BitmapWithCursor bitmapWithCursor = displayQueue.Dequeue();
                    if (bitmapWithCursor != null)
                    {
                        RecPacket.PacketType packetType = bitmapWithCursor.getPacketType();
                        switch (packetType)
                        {
                        case RecPacket.PacketType.BITMAP:
                            Bitmap display = bitmapWithCursor.getScreenBitmap();
                            // Point cursorPoint = new Point(bitmapWithCursor.getCursorPoint().getXPoint(), bitmapWithCursor.getCursorPoint().getYPoint());
                            //using (Graphics g = Graphics.FromImage(bitmapWithCursor.getScreenBitmap()))
                            //{
                            //    Cursor myCursor = Cursor.Current;

                            //    myCursor.Draw(g, new Rectangle(cursorPoint, new Size(10, 10)));
                            //    g.Dispose();
                            //}
                            bitmapWidth  = display.Width;
                            bitmapHeight = display.Height;
                            scaleX       = (float)pictureBoxRec.Width / bitmapWidth;
                            scaleY       = (float)pictureBoxRec.Height / bitmapHeight;
                            pictureBoxRec.BackgroundImage = display;
                            labeldispalyQueue.Text        = "显示队列大小:" + displayQueue.getQueueSize() + "\r\n";
                            break;

                        case RecPacket.PacketType.TEXT:
                            textBoxInfo.Text       = bitmapWithCursor.getStringValue();
                            labeldispalyQueue.Text = "显示队列大小:" + displayQueue.getQueueSize() + "\r\n";
                            break;

                        default:
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
        }