Пример #1
0
        }//drawGrid

        //Black brush
        public void DrawTruthTableHeaders()
        {
            Rect b;
            Point center;
            Brush color;
            InkFigure header = null;

            //For Row 0, draw headers 
            for (int i = 0; i < Number_of_terms; i++)
            {
                b = new Rect(GAP + (i + 1) * GAP, GAP, GAP, GAP);
                center = new Point(b.X + b.Width / 2, b.Y + b.Height / 2);
                color = Brushes.Black;
                header = new InkFigure(Terms_names[i], b, center, color);
                header.SetHeader();
                //RenderCanvas.Children.Add(CreateInkRegion(b));
                RenderCanvas.Children.Add(header);
            }

            //Output
            b = new Rect(GAP * Columns, GAP, GAP, GAP);
            center = new Point(b.X + b.Width / 2, b.Y + b.Height / 2);
            color = Brushes.Black;
            header = new InkFigure("Output", b, center, color);
            header.SetHeader();
            //RenderCanvas.Children.Add(CreateInkRegion(b));
            RenderCanvas.Children.Add(header);
        }
Пример #2
0
        public void DrawTruthTableValues()
        {
            Rect b;
            Point center;
            Brush color;
            InkFigure values = null;

            int termSquares = (int)Math.Pow(2, number_of_terms);

            for (int i = 0; i < termSquares; i++)
            {
                //Draw sequence number
                b = new Rect(GAP, GAP + (i + 1) * GAP, GAP, GAP);
                center = new Point(b.X + b.Width / 2, b.Y + b.Height / 2);
                color = Brushes.Black;
                values = new InkFigure(i.ToString(), b, center, color);
                values.SetHeader();
                RenderCanvas.Children.Add(values);

                //Draw truth table row numbers
                char[] rowValues = ComputeRowValue(i, number_of_terms);
                for (int j = 0; j < Terms_names.Length; j++)
                {
                    b = new Rect((j + 1) * GAP, (i + 1) * GAP, GAP, GAP);
                    center = new Point(b.X + b.Width + b.Width / 2, b.Y + b.Height + b.Height / 2);
                    color = Brushes.Blue;
                    values = new InkFigure(rowValues[j].ToString(), b, center, color);
                    RenderCanvas.Children.Add(values);
                }

                //For output column
                //Output
                b = new Rect(GAP * Columns, (i + 2) * GAP, GAP, GAP);
                center = new Point(b.X + b.Width / 2, b.Y + b.Height / 2);
                color = Brushes.Red;
                values = new InkFigure(Fvalues[i].ToString(), b, center, color);
                values.SetResult();
                RenderCanvas.Children.Add(values);
            }
        }