Exemplo n.º 1
0
        public ChatDlg(Form parent, MessengerClient client, Guid groupSessionGuid, Guid userSessionGuid, string userToConnect)
        {
            mInkPicture = new Microsoft.Ink.InkPicture();
            mOriginalPts = new List<Point[]>();
            mClient = client;
            mUserSessionGuid = userSessionGuid;
            mGroupSessionGuid = groupSessionGuid;
            mParent = parent;

            InitializeComponent();
            this.toolStrip1.Items.Add(this.toolStripButton1);
            this.toolStrip1.Items.Add(this.toolStripButton2);

            this.Text = userToConnect;
            button1.Enabled = false;
            this.splitContainer1.Panel1.Controls.Add(mInkPicture);
            mInkPicture.Dock = DockStyle.Fill;
            //mInkPicture.Width = this.ClientSize.Width;
            //mInkPicture.Height = this.ClientSize.Height;
            //GetXYIndexes(ref PACKET_IDX_PtX, ref PACKET_IDX_PtY);   //Save the X and Y data locations within the packet data.
            mInkPicture.Stroke += new Microsoft.Ink.InkCollectorStrokeEventHandler(InkPicture_Stroke);
            /*
            mReceiveMessageCompletedHandler = new EventHandler<ReceiveMessageCompletedEventArgs>(OnReceiveMessageCompleted);
            mClient.ReceiveMessageCompleted += mReceiveMessageCompletedHandler;
            mReceiveStorokeCompetedHandler = new EventHandler<ReceiveStrokeCompletedEventArgs>(OnReceiveStrokeCompleted);
            mClient.ReceiveStrokeCompleted += mReceiveStorokeCompetedHandler;
            mReceiveBGImgChunkCompletedHandler = new EventHandler<ReceiveBGImgChunkCompletedEventArgs>(OnReceiveBGImgChunkCompleted);
            mClient.ReceiveBGImgChunkCompleted += mReceiveBGImgChunkCompletedHandler;
             */
            mReceiveContentDataCompletedHandler = new EventHandler<ReceiveContentDataCompletedEventArgs>(OnReceiveContentDataCompleted);
            mClient.ReceiveContentDataCompleted += mReceiveContentDataCompletedHandler;
            Form1 form1 = (Form1)parent;
            mUserId = form1.UserId;
            /*
            mClient.ReceiveMessageAsync(mUserSessionGuid);
            mClient.ReceiveStrokeAsync(mUserSessionGuid);
            mClient.ReceiveBGImgChunkAsync(mUserSessionGuid);
             */
            mClient.ReceiveContentDataAsync(mUserSessionGuid);

            string debug = string.Format("{0} - {1}", mUserId, userToConnect);
            WriteLine(debug, Color.Black);
            debug = string.Format("Group {0}", groupSessionGuid.ToString());
            WriteLine(debug, Color.Black);
            debug = string.Format("Group {0}", userSessionGuid.ToString());
            WriteLine(debug, Color.Black);
        }
 public GraphicsProvider(Microsoft.Ink.InkPicture inkPicture, System.Windows.Forms.Form form)
 {
     m_InkPicture = inkPicture;
     m_Graphics = null;
 }
Exemplo n.º 3
0
 public GraphicsProvider(Microsoft.Ink.InkPicture inkPicture, System.Windows.Forms.Form form)
 {
     m_InkPicture = inkPicture;
     m_Graphics   = null;
 }
Exemplo n.º 4
0
        /// <summary>
        /// TEMP draw DataGrid near truth table result
        /// </summary>
        private void displayResult()
        {
            Rectangle inkBoundingBox = sketchPanel.InkPicture.Ink.Strokes.GetBoundingBox();

            System.Drawing.Point drawPoint = new System.Drawing.Point(inkBoundingBox.Right + 200, inkBoundingBox.Top);

            Microsoft.Ink.InkPicture inkPic = sketchPanel.InkPicture;
            using (Graphics g = inkPic.CreateGraphics())
            {
                inkPic.Renderer.InkSpaceToPixel(g, ref drawPoint);
            }


            int gridWidth  = inkBoundingBox.Width;
            int gridHeight = inkBoundingBox.Height;

            ttGrid = new DataGridView();
            ttGrid.DefaultCellStyle.Font = new Font(ttGrid.DefaultCellStyle.Font.FontFamily, 18.0F);
            ttGrid.Location             = drawPoint;
            ttGrid.ColumnCount          = currentResult.NumCols;
            ttGrid.ColumnHeadersVisible = false;
            ttGrid.RowHeadersVisible    = false;

            for (int i = 0; i < currentResult.NumRows + 1; ++i)
            {
                string[] row = new string[currentResult.NumCols];
                for (int j = 0; j < currentResult.NumCols; ++j)
                {
                    if (i == 0)
                    {
                        row[j] = currentResult.LabelPins[j].PinName;
                    }
                    else
                    {
                        row[j] = currentResult.DataMatrix[i - 1, j].ToString();
                    }
                }
                ttGrid.Rows.Add(row);
            }

            ttGrid.Enabled = true;
            sketchPanel.InkPicture.Controls.Add(ttGrid);

            ttGrid.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            ttGrid.AutoSizeRowsMode    = DataGridViewAutoSizeRowsMode.DisplayedCells;
            ttGrid.AutoResizeColumns();
            ttGrid.AutoResizeRows();

            ttGrid.Refresh();

            int colWidth  = 0;
            int rowHeight = 0;

            for (int c = 0; c < ttGrid.ColumnCount; ++c)
            {
                colWidth += ttGrid.Columns[c].Width;
                if (c < currentResult.DividerIndex)
                {
                    ttGrid.Columns[c].DefaultCellStyle.BackColor = Color.LightCoral;
                }
                else
                {
                    ttGrid.Columns[c].DefaultCellStyle.BackColor = Color.LightBlue;
                }
            }

            for (int r = 0; r < ttGrid.RowCount; ++r)
            {
                rowHeight += ttGrid.Rows[r].Height;
            }

            ttGrid.Size = new Size(colWidth + 30, rowHeight + 30);

            ttGrid.Refresh();
        }