예제 #1
0
        internal MiniPadForm(PPTcontrol inputController)
        {
            InitializeComponent();

            pptController = inputController;


            minioverlay = new InkOverlay(this.Handle);

            ClearAppGestures(minioverlay);
            minioverlay.CollectionMode = CollectionMode.InkAndGesture;
            minioverlay.Gesture       += new InkCollectorGestureEventHandler(mo_Gesture);
            minioverlay.SystemGesture += new InkCollectorSystemGestureEventHandler(mo_SystemGesture);

            // make it recognize EVERYTHING
            minioverlay.SetGestureStatus(ApplicationGesture.AllGestures, true);

            //list of gestures
            // arrow x4, check, chevronx4 , circle, curlique

            minioverlay.Enabled = true;

            minipenpanel          = new PenInputPanel(xInput);
            minipenpanel.AutoShow = true;
        }// end miniPadForm constructor
        private void ScaleAndMoveInk(ref InkOverlay ink, Panel panel)
        {
            if (ink.Ink.Strokes.Count == 0)
            {
                return;
            }

            Rectangle box = ink.Ink.GetBoundingBox();
            Graphics  g   = panel.CreateGraphics();

            float scaleX = 1.0f;
            float scaleY = 1.0f;
            float Scale  = 1.0f;

            Point pt = new Point(panel.Width, panel.Height);

            ink.Renderer.PixelToInkSpace(g, ref pt);

            scaleX = (float)pt.X / (float)box.Width * 0.9f;
            scaleY = (float)pt.Y / (float)box.Height * 0.9f;

            Scale = Math.Min(scaleX, scaleY);

            ink.Ink.Strokes.Scale(Scale, Scale);

            float offset = 300.0f;

            box = ink.Ink.GetBoundingBox();

            float InkMovedX = -(float)box.X + offset;
            float InkMovedY = -(float)(box.Y) + offset;

            box = ink.Ink.GetBoundingBox();
            ink.Ink.Strokes.Move(InkMovedX, InkMovedY);
        }
        public ScannedPaperForm()
        {
            // Initialize UI Components
            InitializeComponent();

            // Set the Border style to be non-resizable
            this.FormBorderStyle = FormBorderStyle.FixedSingle;

            // Disable the maximize box
            this.MaximizeBox = false;

            // Construct an InkOverlay attached to the inkForm's inking panel
            myInkOverlay = new InkOverlay(this.inkFormInkingPanel);

            // Create an InkAnalyzer, passing the InkOverlay's Ink Object.
            analyzer = new InkAnalyzer(myInkOverlay.Ink, this);

            // Add an event handler that adds Strokes to the InkAnalyzer as they
            // are collected.
            myInkOverlay.Stroke += new InkCollectorStrokeEventHandler(MyInkOverlayStroke);

            // Enable the InkOverlay to begin collection.
            myInkOverlay.Enabled = true;

            // Add a paint handler to the inking panel to draw the AnalysisHintNodes
            // bounds if the "Show Analysis Hint Bounding Boxes" CheckBox is checked.
            this.inkFormInkingPanel.Paint += new PaintEventHandler(InkFormInkingPanelPaint);

            // Create the AnalysisHintNode that will be used to give the InkAnalyzer
            // additional information about how to interpret strokes.  Also, initialize the
            // TextBoxes where the results from each AnalysisHintNode will be stored.
            this.InitHints();
        }
예제 #4
0
 public Form1()
 {
     InitializeComponent();
     ink         = new InkOverlay(panel1);
     ink.Enabled = true;
     zMoments    = new List <ZernikeMoment>();
 }
예제 #5
0
 protected void Initialize_Ink()
 {
     if (!Component.BARTPE && !Component.VM && !Component.compiled_flowchart &&
         !Component.MONO)
     {
         this.tab_overlay                 = new InkOverlay(this.flow_panel);
         this.tab_overlay.Enabled         = false;
         this.tab_overlay.EditingMode     = InkOverlayEditingMode.Ink;
         this.tab_overlay.CursorInRange  += new InkCollectorCursorInRangeEventHandler(tab_overlay_CursorInRange);
         this.tab_overlay.Stroke         += new InkCollectorStrokeEventHandler(tab_overlay_Stroke);
         this.tab_overlay.StrokesDeleted += new InkOverlayStrokesDeletedEventHandler(tab_overlay_StrokesDeleted);
         this.Disposed += new EventHandler(tab_disposed);
         System.Drawing.Drawing2D.Matrix matrix  = new System.Drawing.Drawing2D.Matrix();
         System.Drawing.Drawing2D.Matrix matrix2 = new System.Drawing.Drawing2D.Matrix();
         this.tab_overlay.Renderer.GetViewTransform(ref matrix2);
         this.tab_overlay.Renderer.SetViewTransform(matrix);
         Graphics g   = this.flow_panel.CreateGraphics();
         Point    pt1 = new Point(50, 50);
         Point    pt2 = new Point(100, 100);
         this.tab_overlay.Renderer.InkSpaceToPixel(g, ref pt1);
         this.tab_overlay.Renderer.InkSpaceToPixel(g, ref pt2);
         ink_resolution = System.Math.Abs(50.0 / (pt2.X - pt1.X));
         this.tab_overlay.Renderer.SetViewTransform(matrix2);
         g.Dispose();
     }
 }
예제 #6
0
        public FormManager()
        {
            InitializeComponent();

            AutoScaleDimensions = new SizeF(AutoScaleDimensions.Width / (AutoScaleDimensions.Width / 4F),
                                            AutoScaleDimensions.Height / (AutoScaleDimensions.Height / 8F));

            // Se crea un objeto InkOverlay y se pone en el modo ink-and-gesture.
            // Se coge este modo y no gesture-only porque este ultimo necesita que
            // transcurra un tiempo para reconocer la gesture.
            ink_overlay = new InkOverlay(pnlInput.Handle);
            ink_overlay.CollectionMode = CollectionMode.InkAndGesture;

            // Se indica al InkOverlay las gestures que queremos reconocer
            ink_overlay.SetGestureStatus(ApplicationGesture.Scratchout, true);

            // Se conecta el manejador de eventos con las gesture y los stroke
            ink_overlay.Gesture += new InkCollectorGestureEventHandler(inkOverlay_Gesture);
            ink_overlay.Stroke  += new InkCollectorStrokeEventHandler(inkOverlay_Stroke);

            // Se habilita el colector
            ink_overlay.Enabled = true;

            strokes_text  = ink_overlay.Ink.CreateStrokes();
            strokes_shape = ink_overlay.Ink.CreateStrokes();
        }
        /// <summary>
        /// Find the best scale for the ink based on bounding box size compared to the panel size.
        /// Then actually scale the ink in both x and y directions after finding the best scale.
        /// Then move the ink to the top left corner of the panel with some padding on left and top.
        /// </summary>
        private void ScaleAndMoveInk(InkOverlay overlayInk, Panel inkPanel, float offset)
        {
            if (overlayInk.Ink.Strokes.Count == 0)
            {
                return;
            }

            Rectangle box = overlayInk.Ink.GetBoundingBox();

            float scaleX = 1.0f;
            float scaleY = 1.0f;

            System.Drawing.Point pt = new System.Drawing.Point(inkPanel.Width, inkPanel.Height);

            overlayInk.Renderer.PixelToInkSpace(inkPanel.CreateGraphics(), ref pt);

            scaleX = (float)pt.X / (float)box.Width * 0.9f;
            scaleY = (float)pt.Y / (float)box.Height * 0.9f;

            float scale = Math.Min(scaleX, scaleY);

            overlayInk.Ink.Strokes.Scale(scale, scale);

            box = overlayInk.Ink.GetBoundingBox();

            float inkMovedX = -(float)(box.X) + offset;
            float inkMovedY = -(float)(box.Y) + offset;

            box = overlayInk.Ink.GetBoundingBox();
            overlayInk.Ink.Strokes.Move(inkMovedX, inkMovedY);
        }
        public ImageResultSubForm(BitmapSymbol unknown, ImageScore template)
        {
            InitializeComponent();

            ImageScore score = template;

            labelNames.Text              = score.SymbolClass + ": " + score.SymbolType;
            labelHausdorff.Text         += score.HausdorfScore.ToString("#0.000");
            labelModifiedHausdorff.Text += score.ModifiedHausdorfScore.ToString("#0.000");
            labelTanimoto.Text          += score.TanimotoScore.ToString("#0.000");
            labelYule.Text         += score.YuleScore.ToString("#0.000");
            labelUserName.Text     += score.UserName;
            labelCompleteness.Text += score.Completeness.ToString();
            labelPlatform.Text     += score.Platform.ToString();

            InkOverlay ink = new InkOverlay(panelInk);

            foreach (Point[] pts in unknown.Points)
            {
                ink.Ink.CreateStroke(pts);
                ink.Ink.Strokes[ink.Ink.Strokes.Count - 1].DrawingAttributes.Color = Color.Blue;
            }
            ScaleAndMoveInk(ref ink);

            InkOverlay     symbolInk = new InkOverlay(panelInk);
            List <Point[]> strokes   = score.TemplateSymbol.Points;

            foreach (Point[] points in strokes)
            {
                symbolInk.Ink.CreateStroke(points);
                symbolInk.Ink.Strokes[symbolInk.Ink.Strokes.Count - 1].DrawingAttributes.Color = Color.Red;
            }
            ScaleAndMoveInk(ref symbolInk);
        }
예제 #9
0
        /// <summary>
        /// Event Handler from Form Load Event
        /// Setup the ink overlay for collection
        /// </summary>
        /// <param name="sender">The control that raised the event.</param>
        /// <param name="e">The event arguments.</param>
        private void InkDividerForm_Load(object sender, System.EventArgs e)
        {
            // Create the ink overlay and associate it with the form
            myInkOverlay = new Microsoft.Ink.InkOverlay(DrawArea.Handle);

            // Hook event handler for the Stroke event to myInkOverlay_Stroke.
            // This is necessary since the application needs to pass the strokes
            // to the ink divider.
            myInkOverlay.Stroke += new InkCollectorStrokeEventHandler(myInkOverlay_Stroke);

            // Hook the event handler for StrokeDeleting event to myInkOverlay_StrokeDeleting.
            // This is necessary as the application needs to remove the strokes from
            // ink divider object as well.
            myInkOverlay.StrokesDeleting += new InkOverlayStrokesDeletingEventHandler(myInkOverlay_StrokeDeleting);

            // Hook the event handler for StrokeDeleted event to myInkOverlay_StrokeDeleted.
            // This is necessary to update the layout analysis result when automatic layout analysis
            // option is selected.
            myInkOverlay.StrokesDeleted += new InkOverlayStrokesDeletedEventHandler(myInkOverlay_StrokeDeleted);

            // Create the ink divider object
            myInkDivider = new Divider();

            // Add a default recognizer context to the divider object
            // without adding the recognizer context, the divider would
            // not use a recognizer to do its word segmentation and would
            // have less accurate results.
            // Adding the recognizer context will slow down the call to
            // myInkDivider.Divide though.
            // It is possible that there is no recognizer installed on the
            // machine for this language. In that case the divider will
            // not use a recognizer to improve its accuracy.
            // Get the default recognizer if any
            try
            {
                Recognizers recognizers = new Recognizers();
                myInkDivider.RecognizerContext = recognizers.GetDefaultRecognizer().CreateRecognizerContext();
            }
            catch (InvalidOperationException)
            {
                //We are in the case where no default recognizers can be found
            }

            // The LineHeight property helps the InkDivider distinguish between
            // drawing and handwriting. The value should be the expected height
            // of the user's handwriting in ink space units (0.01mm).
            // Here we set the LineHeight to 840, which is about 1/3 of an inch.
            myInkDivider.LineHeight = 840;

            // Assign ink overlay's strokes collection to the ink divider
            // This strokes collection will be updated in the event handler
            myInkDivider.Strokes = myInkOverlay.Ink.Strokes;

            // Enable ink collection
            myInkOverlay.Enabled = true;

            // Set check for ink menu item
            miInk.Checked = true;
        }
예제 #10
0
 /// <summary>
 /// Constructor -- attaches an ink overlay and adds
 /// the mouseMove event handler
 /// </summary>
 /// <param name="inputBasicForm"></param>
 public CornerForm(BasicForm inputBasicForm)
 {
     basicform = inputBasicForm;
     InitializeComponent();
     corneroverlay            = new InkOverlay(panel1.Handle);
     corneroverlay.MouseMove += new InkCollectorMouseMoveEventHandler(co_MouseMove);
     corneroverlay.Enabled    = true;
 }
        /// <summary>
        /// Populates the stroke objects in an Ink Overlay object using the
        /// substrokes in a sketch object
        /// </summary>
        /// <param name="sketch">Sketch containing substrokes to convert</param>
        private void FillInkOverlay(ClusteringResultsShape shapeResults, InkOverlay overlayInk, Panel inkPanel, float paddingOffset, Dictionary <Guid, string> strokeClassifications)
        {
            overlayInk.Ink.DeleteStrokes();
            List <Substroke> strokesAdded = new List <Substroke>();

            foreach (Substroke s in shapeResults.Shape.SubstrokesL)
            {
                string type = GetShapeType(s.ParentShapes[0]);
                if (strokeClassifications[s.Id] == type && shapeResults.BestCluster.contains(s.Id))
                {
                    overlayInk.Ink.CreateStroke(s.PointsAsSysPoints);
                    if (this.strokeColor.ContainsKey(s))
                    {
                        overlayInk.Ink.Strokes[overlayInk.Ink.Strokes.Count - 1].DrawingAttributes.Color = this.strokeColor[s];
                    }
                    strokesAdded.Add(s);
                }
                else if (strokeClassifications[s.Id] == type && !shapeResults.BestCluster.contains(s.Id))
                {
                    overlayInk.Ink.CreateStroke(s.PointsAsSysPoints);
                    if (this.strokeColor.ContainsKey(s))
                    {
                        overlayInk.Ink.Strokes[overlayInk.Ink.Strokes.Count - 1].DrawingAttributes.Color = this.strokeColor[s];
                    }
                    strokesAdded.Add(s);
                }
            }

            foreach (Substroke s in shapeResults.BestCluster.Strokes)
            {
                if (!strokesAdded.Contains(s))
                {
                    string type = GetShapeType(s.ParentShapes[0]);
                    if (strokeClassifications[s.Id] == type)
                    {
                        overlayInk.Ink.CreateStroke(s.PointsAsSysPoints);
                        if (this.strokeColor.ContainsKey(s))
                        {
                            overlayInk.Ink.Strokes[overlayInk.Ink.Strokes.Count - 1].DrawingAttributes.Color = this.strokeColor[s];
                        }
                    }
                    else if (strokeClassifications[s.Id] != type)
                    {
                        overlayInk.Ink.CreateStroke(s.PointsAsSysPoints);
                        if (this.strokeColor.ContainsKey(s))
                        {
                            overlayInk.Ink.Strokes[overlayInk.Ink.Strokes.Count - 1].DrawingAttributes.Color = this.strokeColor[s];
                        }
                    }
                }
            }

            // Move center the ink's origin to the top-left corner
            Rectangle bb = overlayInk.Ink.GetBoundingBox();

            ScaleAndMoveInk(overlayInk, inkPanel, paddingOffset);
            UpdateColors(overlayInk, inkPanel);
        }
        /// <summary>
        /// Updates the colors of a sketch based on the lookup table
        /// </summary>
        private void UpdateColors(InkOverlay overlayInk, Panel inkPanel)
        {
            foreach (Microsoft.Ink.Stroke s in overlayInk.Ink.Strokes)
            {
                //s.DrawingAttributes.Color = _MStroke2Color[s.Id];
            }

            inkPanel.Refresh();
        }
        public ClusterAccuracyForm(ClusteringResultsSketch results)
        {
            InitializeComponent();

            this.results = results;
            strokeColor  = new Dictionary <Substroke, Color>(results.Sketch.Substrokes.Length);
            FindColors(results);

            UpdateCurrentResultsNumber(1);

            this.clusterInkPanel.Enabled      = true;
            clusterInkOverlay                 = new InkOverlay();
            clusterInkOverlay.AttachedControl = this.clusterInkPanel;
            clusterInkOverlay.Enabled         = false;
            if (currentResultsNumber >= 0)
            {
                FillInkOverlay(results.ResultsShape[currentResultsNumber], clusterInkOverlay, clusterInkPanel, paddingOffset, results.StrokeClassifications);
            }
            else
            {
                FillInkOverlay(new Sketch.Sketch(), clusterInkOverlay, clusterInkPanel, paddingOffset, results.StrokeClassifications);
            }

            this.sketchInkPanel.Enabled = true;
            InkOverlay sketchInkOverlay = new InkOverlay();

            sketchInkOverlay.AttachedControl = this.sketchInkPanel;
            sketchInkOverlay.Enabled         = false;
            FillInkOverlay(results.Sketch, sketchInkOverlay, sketchInkPanel, paddingOffset, results.StrokeClassifications);

            labelTotalNumErrors.Text             += results.NumTotalErrors.ToString();
            labelTotalPerfectClusters.Text       += results.NumPerfect.ToString();
            labelConditionalPerfectClusters.Text += results.NumConditionalPerfect.ToString();
            labelSplitErrors.Text += results.NumSplitErrors.ToString();
            labelMergeErrors.Text += results.NumMergeErrors.ToString();

            labelMergeShape2ShapeErrors.Text += results.NumMergedShapeToShapeErrors.ToString();
            labelMergedWire2ShapeErrors.Text += results.NumMergedConnectorToShapeErrors.ToString();
            labelMergedText2ShapeErrors.Text += results.NumMergedTextToShapeErrors.ToString();
            labelMergeShape2Text.Text        += results.NumMergedShapeToTextErrors.ToString();
            labelMergeWire2Text.Text         += results.NumMergedConnectorToTextErrors.ToString();
            labelMergeText2Text.Text         += results.NumMergedTextToTextErrors.ToString();
            labelMergeNOTBUBBLE.Text         += results.NumMergedNOTBUBBLEToShapeErrors.ToString();

            double percentage = results.InkMatchingPercentage * 100.0;

            labelInkMatchingPercentage.Text += percentage.ToString("#0.0") + "%";
            percentage = results.InkExtraPercentageTotal * 100.0;
            labelInkExtraTotalPercentage.Text += percentage.ToString("#0.0") + "%";
            percentage = results.InkExtraPercentageBestMatches * 100.0;
            labelInkExtraFromBestClusters.Text += percentage.ToString("#0.0") + "%";
            percentage = results.InkExtraPercentagePartialMatchesNotBest * 100.0;
            labelInkExtraPartialMatches.Text += percentage.ToString("#0.0") + "%";
            percentage = results.InkExtraPercentageCompletelyUnMatched * 100.0;
            labelInkExtraCompletelyUnmatched.Text += percentage.ToString("#0.0") + "%";
        }
예제 #14
0
        }// end method mo_systemgesture

        private void ClearAppGestures(InkOverlay minioverlay)
        {
            ApplicationGesture nogesture = ApplicationGesture.NoGesture;

            System.Array gestureIDs = System.Enum.GetValues(nogesture.GetType());
            foreach (ApplicationGesture gestureID in gestureIDs)
            {
                minioverlay.SetGestureStatus(gestureID, false);
            }
        }
예제 #15
0
        public TidyUp(Sketch sketch, Panel panel, InkOverlay drawing)
        {
            this.sketch     = sketch;
            this.inkPanel   = panel;
            this.drawingInk = drawing;

            ///初始化skeleton stroke的属性
            this.Skeleton_Attibute.Color = Skeleton_Color;
            this.Skeleton_Attibute.Width = Skeleton_Width;
        }
        private void InitializePanel(Panel panel, Sketch.Shape shape)
        {
            InkOverlay ink = new InkOverlay(panel);

            foreach (Sketch.Substroke s in shape.SubstrokesL)
            {
                ink.Ink.CreateStroke(s.PointsAsSysPoints);
                ink.Ink.Strokes[ink.Ink.Strokes.Count - 1].DrawingAttributes.Color = Color.Black;
            }
            ScaleAndMoveInk(ref ink, panel);
        }
예제 #17
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="ptsToAdd">Unique points to add to the current Hashtable</param>
        /// <param name="strokeToCorners">Hashtable mapping FeatureStrokes to fragment points</param>
        /// <param name="overlayInk">InkOverlay to draw the points on</param>
        /// <param name="fragmentPtAttributes">Attributes for the drawn fragment points</param>
        public HandFragmentCornersCmd(Dictionary <Sketch.Stroke, List <int> > ptsToAdd,
                                      Dictionary <Sketch.Stroke, List <int> > strokeToCorners,
                                      InkOverlay overlayInk, Microsoft.Ink.DrawingAttributes fragmentPtAttributes)
        {
            this.ptsToAdd             = new Dictionary <Sketch.Stroke, List <int> >(ptsToAdd);
            this.strokeToCorners      = strokeToCorners;
            this.overlayInk           = overlayInk;
            this.fragmentPtAttributes = fragmentPtAttributes;

            this.fragmentPtsDrawn = new List <System.Drawing.Point>();
        }
예제 #18
0
        public N_Dollar_Form()
        {
            InitializeComponent();

            m_Ink         = new InkOverlay(inkPanel);
            m_Ink.Enabled = true;

            m_Recognizer = new NDollar();

            m_ReadJnt = new ReadJnt();
        }
예제 #19
0
 public Form1()
 {
     InitializeComponent();
     InkOverlay = new InkOverlay
     {
         Handle  = panel2.Handle,
         Enabled = true
     };
     //inkOverlay.Ink.Save(PersistenceFormat.Gif);
     SetDrawingAttributes();
     ToEditMode();
 }
예제 #20
0
        public Form1()
        {
            InitializeComponent();
            InkOverlay = new InkOverlay
            {
                Handle  = panel2.Handle,
                Enabled = true
            };

            SetDrawingAttributes();
            ToEditMode();
        }
예제 #21
0
        public ClusterForm(Strokes strokes, List <Sketch.Substroke> substrokes, Dictionary <string, List <SymbolRank> > SRs, BitmapSymbol Unknown)
        {
            InitializeComponent();

            InkPanel.Enabled            = true;
            _OverlayInk                 = new Microsoft.Ink.InkOverlay();
            _OverlayInk.AttachedControl = InkPanel;
            _OverlayInk.Enabled         = false;

            FillInkOverlay(strokes);
            FillLabels(substrokes, SRs);
        }
예제 #22
0
        //Necessary conversion for rendering strokes
        public static Rectangle InkSpaceToPixelRect(InkOverlay i, Graphics g, Rectangle rect)
        {
            Point ul = new Point(rect.Left, rect.Top);
            Point lr = new Point(rect.Right, rect.Bottom);

            Point[] pts = { ul, lr };
            i.Renderer.InkSpaceToPixel(g, ref pts);

            ul = pts[0]; lr = pts[1];
            Rectangle r = new Rectangle(ul.X, ul.Y, lr.X - ul.X, lr.Y - ul.Y);

            return(r);
        }
예제 #23
0
        public WriteLetter_Test(WritePhaseForm writePhase, String str)
        {
            this.writePhase  = writePhase;
            levelStr         = str;
            this.WindowState = FormWindowState.Maximized;
            InitializeComponent();
            letterArr = generateAlphabets(letters);

            LetterLabel.Text        = str;
            this.FormBorderStyle    = System.Windows.Forms.FormBorderStyle.None;
            this.inkOverlay         = new InkOverlay(this);
            this.inkOverlay.Enabled = true;
            this.FormClosing       += new FormClosingEventHandler(WriteLetter_Test_FormClosing);
        }
예제 #24
0
        private void CreateRecognizer(InkOverlay overlay)
        {
            Recognizers recognizers = new Recognizers();
            Recognizer english = recognizers.GetDefaultRecognizer();
            context = english.CreateRecognizerContext();

            WordList wordList = new WordList();
            for (int i = 0; i < 100; ++i)
                wordList.Add(i.ToString());

            context.WordList = wordList;
            context.Factoid = Factoid.WordList;
            context.RecognitionFlags = RecognitionModes.Coerce;
        }
예제 #25
0
 public Edge(Node n1, Node n2, InkOverlay i, int weight)
 {
     //Keep track of the nodes its attached to
     this.a = n1;
     this.b = n2;
     this.weight = weight;
     color = DEFAULT;
     //Make sure the nodes contain this in their edges
     a.Edges.Add(this);
     b.Edges.Add(this);
     Point[] p = {a.CenterPoint,b.CenterPoint};
     //Draw a stroke connecting both nodes
     this.stroke = i.Ink.CreateStroke(p);
 }
예제 #26
0
        public Form1()
        {
            InitializeComponent();
            InkOverlay = new InkOverlay
            {
                Handle  = panel2.Handle,
                Enabled = true
            };

            SetDrawingAttributes();
            ToEditMode();
            Candidates           = new ObservableCollection <string>();
            comboBox1.DataSource = Candidates;
        }
예제 #27
0
 public Edge(Node n1, Node n2, InkOverlay i, int weight)
 {
     //Keep track of the nodes its attached to
     this.a      = n1;
     this.b      = n2;
     this.weight = weight;
     color       = DEFAULT;
     //Make sure the nodes contain this in their edges
     a.Edges.Add(this);
     b.Edges.Add(this);
     Point[] p = { a.CenterPoint, b.CenterPoint };
     //Draw a stroke connecting both nodes
     this.stroke = i.Ink.CreateStroke(p);
 }
예제 #28
0
        public WriteLetter_Test(WritePhaseForm writePhase, String str)
        {
            this.writePhase = writePhase;
            levelStr = str;
            this.WindowState = FormWindowState.Maximized;
            InitializeComponent();
            letterArr = generateAlphabets(letters);

            LetterLabel.Text = str;
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
            this.inkOverlay = new InkOverlay(this);
            this.inkOverlay.Enabled = true;
            this.FormClosing += new FormClosingEventHandler(WriteLetter_Test_FormClosing);
        }
예제 #29
0
        public Canvas()
        {
            InitializeComponent();

            graph       = new Graph();
            animations  = new ArrayList();
            animStarted = false;
            weight      = -1;
            prevEdgeHit = null;

            // Declare repaint optimizations.
            base.SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.DoubleBuffer,
                true);

            this.Paint += new PaintEventHandler(Canvas_Paint);
            inkOverlay  = new InkOverlay(this.Handle, true);    //attach to form, allow use of mouse for input
            inkOverlay.CollectionMode = CollectionMode.InkOnly; // allow ink only, no gestures

            inkOverlay.AutoRedraw = false;                      // Dynamic rendering	only; we do	all	the	painting.

            DrawingAttributes da = new DrawingAttributes();

            da.AntiAliased  = true;             //Makes everything nice and smooth lookin'
            da.Transparency = 0;
            da.PenTip       = Microsoft.Ink.PenTip.Ball;
            da.Width        = 70.0f;
            inkOverlay.DefaultDrawingAttributes = da;

            //Triggered at each pen stroke
            inkOverlay.Stroke += new InkCollectorStrokeEventHandler(inkOverlay_Stroke);
            //Triggered at each eraser stroke
            inkOverlay.StrokesDeleting += new InkOverlayStrokesDeletingEventHandler(inkOverlay_StrokesDeleting);
            //Triggered when a selection of strokes is moved
            inkOverlay.SelectionMoved += new InkOverlaySelectionMovedEventHandler(inkOverlay_SelectionMoved);
            //Triggered when a selection of strokes is resized
            inkOverlay.SelectionResized += new InkOverlaySelectionResizedEventHandler(inkOverlay_SelectionResized);
            inkOverlay.Enabled           = true;

            myRecognizer         = new RecognizerContext();
            myRecognizer.Strokes = inkOverlay.Ink.CreateStrokes();

            edgeTimer           = new System.Timers.Timer(TIME_INTERVAL);
            edgeTimer.AutoReset = true;
            edgeTimer.Elapsed  += new ElapsedEventHandler(edgeTimer_Elapsed);
            edgeTimer.Enabled   = true;
        }
예제 #30
0
        /* Makes a perfectly rectangular stroke out of the
         * given stroke by using its bounding area.
         */
        public static Stroke makeRect(InkOverlay i, Stroke s)
        {
            Rectangle r = s.GetBoundingBox();

            Point[] points = new Point[5];
            points[0] = new Point(r.X, r.Y + r.Height);
            points[1] = new Point(r.X + r.Width, points[0].Y);
            points[2] = new Point(points[1].X, r.Y);
            points[3] = new Point(points[0].X, points[2].Y);
            points[4] = new Point(points[0].X, points[0].Y);
            Stroke rectangle = s.Ink.CreateStroke(points);

            rectangle.DrawingAttributes = i.DefaultDrawingAttributes;
            return(rectangle);
        }
예제 #31
0
        public void Render(InkOverlay i, Graphics g)
        {
            int width  = weight.ToString().Length *15;
            int height = 18;

            stroke.DrawingAttributes       = i.DefaultDrawingAttributes.Clone();
            stroke.DrawingAttributes.Color = color;
            i.Renderer.Draw(g, stroke);

            Rectangle rect   = StrokeManager.InkSpaceToPixelRect(i, g, stroke.GetBoundingBox());
            Point     center = new Point(rect.X + rect.Width / 2 - width / 2, rect.Y + rect.Height / 2 - height / 2);

            g.FillRectangle(new SolidBrush(Color.White), center.X, center.Y, width, height);
            g.DrawString(weight.ToString(), new Font("Courier New", 14, FontStyle.Bold), new SolidBrush(Color.Black), center);
        }
예제 #32
0
        public Canvas()
        {
            InitializeComponent();

            graph = new Graph();
            animations = new ArrayList();
            animStarted = false;
            weight = -1;
            prevEdgeHit = null;

            // Declare repaint optimizations.
            base.SetStyle(
                ControlStyles.UserPaint|
                ControlStyles.AllPaintingInWmPaint|
                ControlStyles.DoubleBuffer,
                true);

            this.Paint += new PaintEventHandler(Canvas_Paint);
            inkOverlay = new InkOverlay(this.Handle, true); //attach to form, allow use of mouse for input
            inkOverlay.CollectionMode =	CollectionMode.InkOnly;	// allow ink only, no gestures

            inkOverlay.AutoRedraw =	false; // Dynamic rendering	only; we do	all	the	painting.

            DrawingAttributes da = new DrawingAttributes();
            da.AntiAliased = true;  //Makes everything nice and smooth lookin'
            da.Transparency = 0;
            da.PenTip = Microsoft.Ink.PenTip.Ball;
            da.Width = 70.0f;
            inkOverlay.DefaultDrawingAttributes	= da;

            //Triggered at each pen stroke
            inkOverlay.Stroke += new InkCollectorStrokeEventHandler(inkOverlay_Stroke);
            //Triggered at each eraser stroke
            inkOverlay.StrokesDeleting += new InkOverlayStrokesDeletingEventHandler(inkOverlay_StrokesDeleting);
            //Triggered when a selection of strokes is moved
            inkOverlay.SelectionMoved += new InkOverlaySelectionMovedEventHandler(inkOverlay_SelectionMoved);
            //Triggered when a selection of strokes is resized
            inkOverlay.SelectionResized +=new InkOverlaySelectionResizedEventHandler(inkOverlay_SelectionResized);
            inkOverlay.Enabled = true;

            myRecognizer = new RecognizerContext();
            myRecognizer.Strokes = inkOverlay.Ink.CreateStrokes();

            edgeTimer = new System.Timers.Timer(TIME_INTERVAL);
            edgeTimer.AutoReset = true;
            edgeTimer.Elapsed +=new ElapsedEventHandler(edgeTimer_Elapsed);
            edgeTimer.Enabled = true;
        }
예제 #33
0
        private void WhiteBoardForm_Load(object sender, System.EventArgs e)
        {
            // Provide the InkOverlay with its drawing surface
            inkOverlay = new InkOverlay(pbInk);

            // Hook up stroke events
            inkOverlay.Stroke          += new InkCollectorStrokeEventHandler(inkOverlay_Stroke);
            inkOverlay.StrokesDeleting += new InkOverlayStrokesDeletingEventHandler(inkOverlay_StrokesDeleting);
            inkOverlay.CursorInRange   += new InkCollectorCursorInRangeEventHandler(inkOverlay_CursorInRange);

            // We're now set to go, so turn on tablet input
            inkOverlay.Enabled = true;

            // Link the inkOverlay to the inkToolBar control
            inkToolBar.InkOverlay = inkOverlay;
        }
예제 #34
0
    public RecognizerForm()
    {
      InitializeComponent();

      //Initialize service
      _recognizer = new NNRecognizer();

      _drawingInk = new InkOverlay(pnlDrawing.Handle)
      {
        AttachedControl = pnlDrawing,
        Enabled = true,
        DynamicRendering = true
      };

      _drawingInk.Stroke += new InkCollectorStrokeEventHandler(drawingInk_Stroke);
    }
예제 #35
0
        public RecognizerForm()
        {
            InitializeComponent();

            //Initialize service
            _recognizer = new NNRecognizer();

            _drawingInk = new InkOverlay(pnlDrawing.Handle)
            {
                AttachedControl  = pnlDrawing,
                Enabled          = true,
                DynamicRendering = true
            };

            _drawingInk.Stroke += new InkCollectorStrokeEventHandler(drawingInk_Stroke);
        }
        /// <summary>
        /// Creates a new capture component and attaches it to the specified control.
        /// </summary>
        /// <param name="attachedControl"></param>
        public InkDataCapture(Control attachedControl)
        {
            _Overlay = new InkOverlay(attachedControl);

            _Overlay.AttachMode = InkOverlayAttachMode.Behind;
            _Overlay.CollectionMode = CollectionMode.InkOnly;
            _Overlay.EditingMode = InkOverlayEditingMode.Ink;	//draw ink

            _Overlay.DynamicRendering = false;	//don't draw ink as it is presented
            _Overlay.AutoRedraw = false; //don't redraw ink when necessary

            //collect data as {X, Y, Pressure?} samples
            _Overlay.DesiredPacketDescription = new Guid[]{
                        PacketProperty.X,
                        PacketProperty.Y,
                        PacketProperty.TimerTick,
                        PacketProperty.NormalPressure};

            _Overlay.NewPackets += new InkCollectorNewPacketsEventHandler(Overlay_NewPackets);
        }
예제 #37
0
        /* Makes a perfectly circular stroke given another
         * stroke by using its bounding area as a reference for
         * radius.
         */
        public static Stroke makeCircle(InkOverlay i, Stroke s)
        {
            Point[] points = new Point[101];
            double theta = 2*Math.PI/100.0;
            Rectangle r = s.GetBoundingBox();
            double radius = (r.Width + r.Height)/4.0;
            int deltaX = r.X + r.Width/2;
            int deltaY = r.Y + r.Height/2;
            for(int k = 0; k < points.Length - 1; k++)
            {
                int x = (int) (radius*Math.Cos(k*theta) + deltaX);
                int y = (int) (radius*Math.Sin(k*theta) + deltaY);

                points[k] = new Point(x, y);
            }
            //Last point is the first point, i.e. it is a closed stroke
            points[100] = new Point(points[0].X, points[0].Y);
            Stroke circle = s.Ink.CreateStroke(points);
            circle.DrawingAttributes = i.DefaultDrawingAttributes;
            return circle;
        }
예제 #38
0
 /* Makes a perfectly rectangular stroke out of the
  * given stroke by using its bounding area.
  */
 public static Stroke makeRect(InkOverlay i, Stroke s)
 {
     Rectangle r = s.GetBoundingBox();
     Point[] points = new Point[5];
     points[0] = new Point(r.X, r.Y + r.Height);
     points[1] = new Point(r.X + r.Width, points[0].Y);
     points[2] = new Point(points[1].X, r.Y);
     points[3] = new Point(points[0].X, points[2].Y);
     points[4] = new Point(points[0].X, points[0].Y);
     Stroke rectangle = s.Ink.CreateStroke(points);
     rectangle.DrawingAttributes = i.DefaultDrawingAttributes;
     return rectangle;
 }
예제 #39
0
        void ToDoItemControl_HandleCreated(object sender, EventArgs e)
        {
            panel1.BackColor = Color.Transparent;
            overlay = new InkOverlay(panel1);
            overlay.Enabled = true;

            overlay.CollectionMode = CollectionMode.InkAndGesture;
            overlay.SetGestureStatus(ApplicationGesture.Up, true);
            overlay.SetGestureStatus(ApplicationGesture.Down, true);
            overlay.SetGestureStatus(ApplicationGesture.Right, true);
            overlay.SetGestureStatus(ApplicationGesture.ArrowUp, true);
            overlay.SetGestureStatus(ApplicationGesture.ArrowDown, true);
            overlay.SetGestureStatus(ApplicationGesture.Check, true);
            overlay.SetGestureStatus(ApplicationGesture.Square, true);
            overlay.SetGestureStatus(ApplicationGesture.Circle, true);
            //overlay.Gesture += new InkCollectorGestureEventHandler(overlay_Gesture);
            overlay.Stroke += new InkCollectorStrokeEventHandler(overlay_Stroke);

            CreateRecognizer(overlay);

            personFont = new Font(Font, FontStyle.Bold);
        }
예제 #40
0
 //Renders each edge and node and also marks the home and destination nodes
 public void Render(InkOverlay i, Graphics g)
 {
     for(int j=0; j<edges.Length(); j++)
     {
         edges[j].Render(i,g);
     }
     for(int j=0; j<nodes.Length(); j++)
     {
         nodes[j].Render(i, g);
         if(nodes[j].Equals(home))
         {
             g.DrawString("*",new Font("Arial",30),new SolidBrush(Color.Green),StrokeManager.InkSpaceToPixelRect(i, g,nodes[j].Stroke.GetBoundingBox()));
         }
         else if(nodes[j].Equals(destination))
         {
             g.DrawString("X",new Font("Arial",14,FontStyle.Bold) ,new SolidBrush(Color.Red),StrokeManager.InkSpaceToPixelRect(i,g,nodes[j].Stroke.GetBoundingBox()));
         }
     }
 }
        /// <summary>
        /// This method occurs when the form is loaded.  It
        /// configures the insertion mode, the ink used by
        /// this application, and the default behavior for the PenInputPanels.
        /// </summary>
        /// <param name="sender">The control that raised the event.</param>
        /// <param name="e">The event arguments.</param>
        private void AutoClaims_Load(object sender, System.EventArgs e)
        {
            // Initialize the empty ink.
            emptyInk = new Ink();

            // Create a list to store the Ink collected from the TIP.
            insertedInk = new System.Collections.Generic.List<Ink>();

            // Create InkOverlay to display signature
            theInkOverlay = new InkOverlay(panelForSignature.Handle);
            theInkOverlay.Enabled = true;

            // Initialize the TextInputPanel objects inside a Try/Catch block
            // since the objects are not supported on some SKUs.
            try
            {
                // Initialize the TextInputPanel objects.
                // - tipShared is attached dynamically at run-time
                // - tipPolicyNumber is only attached to the Policy Number field
                // - tipName is only attached to the Insured Name field
                tipShared = new TextInputPanel();
                tipPolicyNumber = new TextInputPanel(inkEdPolicyNumber);
                tipName = new TextInputPanel(inkEdName);
                tipSignature = new TextInputPanel(inkEdSignature);

                // Policy numbers are typically prone to recognizer errors, so we'll
                // default to the keyboard panel to be visible for the Policy number.
                // We set the PreferredInPlaceDirection to Top so that TIP does not cover the control below
                // We also set default inplace state to be expanded to save a step for the user.
                tipPolicyNumber.DefaultInputArea = PanelInputArea.Keyboard;
                tipPolicyNumber.PreferredInPlaceDirection = InPlaceDirection.Top;
                tipPolicyNumber.DefaultInPlaceState = InPlaceState.Expanded;

                // Policy name are also prone to recognizer error, so we'll default
                // to Character Pad.
                // We set the PreferredInPlaceDirection to Top so that TIP does not cover the control below
                // We also set default inplace state to be expanded.
                tipName.DefaultInputArea = PanelInputArea.WritingPad;
                tipName.PreferredInPlaceDirection = InPlaceDirection.Top;
                tipName.DefaultInPlaceState = InPlaceState.Expanded;

                // We default to lined input. We also default to opening TIP upward and expanded.
                tipSignature.DefaultInputArea = PanelInputArea.WritingPad;
                tipSignature.PreferredInPlaceDirection = InPlaceDirection.Top;
                tipSignature.DefaultInPlaceState = InPlaceState.Expanded;

                // Add Event Handlers for tipShared, so that we can track tipShared's events.
                tipShared.InputAreaChanging += new EventHandler<InputAreaChangeEventArgs>(tip_InputAreaChanging);
                tipShared.InputAreaChanged += new EventHandler<InputAreaChangeEventArgs>(tip_InputAreaChanged);

                tipShared.InPlaceVisibilityChanging += new EventHandler<InPlaceVisibilityChangeEventArgs>(tip_InPlaceVisibilityChanging);
                tipShared.InPlaceVisibilityChanged += new EventHandler<InPlaceVisibilityChangeEventArgs>(tip_InPlaceVisibilityChanged);

                tipShared.CorrectionModeChanging += new EventHandler<CorrectionModeChangeEventArgs>(tip_CorrectionModeChanging);
                tipShared.CorrectionModeChanged += new EventHandler<CorrectionModeChangeEventArgs>(tip_CorrectionModeChanged);

                tipShared.InPlaceSizeChanging += new EventHandler<InPlaceSizeChangeEventArgs>(tip_InPlaceSizeChanging);
                tipShared.InPlaceSizeChanged += new EventHandler<InPlaceSizeChangeEventArgs>(tip_InPlaceSizeChanged);

                tipShared.InPlaceStateChanging += new EventHandler<InPlaceStateChangeEventArgs>(tip_InPlaceStateChanging);
                tipShared.InPlaceStateChanged += new EventHandler<InPlaceStateChangeEventArgs>(tip_InPlaceStateChanged);

                tipShared.TextInserting += new EventHandler<TextInsertionEventArgs>(tip_TextInserting);
                tipShared.TextInserted += new EventHandler<TextInsertionEventArgs>(tip_TextInserted);

                // Add Event Handler for tipSignature, so that we can draw ink input on panelForDrawing.
                tipSignature.TextInserting += new EventHandler<TextInsertionEventArgs>(tip_TextInserting);
                tipSignature.TextInserted += new EventHandler<TextInsertionEventArgs>(tip_TextInserted);
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                // If the peninputpanel objects cannot be created, set them
                // to null. Other code that references these objects will need
                // to check
                if (ex.ErrorCode == ObjectsNotInstalledError)
                {
                    tipShared = null;
                    tipPolicyNumber = null;
                    tipName = null;
                }
                else
                {
                    throw; // rethrow unexpected exception
                }
            }

            // Initialize the four different layers of ink on the vehicle diagram:
            // vehihcle body, windows, tires, and headlights.
            inkLayers = new InkLayer[4];
            inkLayers[0] = new InkLayer(new Ink(), Color.Red, false);
            inkLayers[1] = new InkLayer(new Ink(), Color.Violet, false);
            inkLayers[2] = new InkLayer(new Ink(), Color.LightGreen, false);
            inkLayers[3] = new InkLayer(new Ink(), Color.Aqua, false);

            // By default, select the first ink layer
            lstAnnotationLayer.SelectedIndex = 0;
            inkPictVehicle.DefaultDrawingAttributes.Color = inkLayers[lstAnnotationLayer.SelectedIndex].ActiveColor;
        }
예제 #42
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WritingRecognition"/> class.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="culture">The culture.</param>
 public WritingRecognition(Control control, CultureInfo culture)
 {
     foreach (Recognizer reco in _recognizers)
         for (int c = 0; c < reco.Languages.Length; c++)
             if (reco.Languages[c] == culture.LCID)
             {
                 _context = reco.CreateRecognizerContext();
                 break;
             }
     if (_context == null)
     {
         MessageBox.Show(culture.DisplayName + " handwriting recognition support isn't installed on this Windows.", "Rincevent", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         return;
     }
     _inkOverlay = new InkOverlay(control, true);
     _inkOverlay.Enabled = true;
     _strokes = _inkOverlay.Ink.CreateStrokes();
     _context.Strokes = _strokes;
     _inkOverlay.Stroke += inkOverlay_Stroke;
     _inkOverlay.DefaultDrawingAttributes.AntiAliased = true;
     _inkOverlay.DefaultDrawingAttributes.Color = Color.DarkViolet;
     _inkOverlay.DefaultDrawingAttributes.FitToCurve = true;
     _context.RecognitionWithAlternates += context_RecognitionWithAlternates;
 }
예제 #43
0
		public FormCollection(Root root)
		{
			Root = root;
			InitializeComponent();

			this.Left = SystemInformation.VirtualScreen.Left;
			this.Top = SystemInformation.VirtualScreen.Top;
			int targetbottom = 0;
			foreach (Screen screen in Screen.AllScreens)
			{
				if (screen.WorkingArea.Bottom > targetbottom)
					targetbottom = screen.WorkingArea.Bottom;
			}
			int virwidth = SystemInformation.VirtualScreen.Width;
			this.Width = virwidth;
			this.Height = targetbottom - this.Top;
			this.DoubleBuffered = true;

			gpButtonsLeft = Screen.PrimaryScreen.WorkingArea.Right - gpButtons.Width + (Screen.PrimaryScreen.WorkingArea.Left - SystemInformation.VirtualScreen.Left);
			gpButtonsTop = Screen.PrimaryScreen.WorkingArea.Bottom - gpButtons.Height - 10 + (Screen.PrimaryScreen.WorkingArea.Top - SystemInformation.VirtualScreen.Top);
			gpButtons.Left = gpButtonsLeft + gpButtons.Width;
			gpButtons.Top = gpButtonsTop;

			IC = new InkOverlay(this.Handle);
			IC.CollectionMode = CollectionMode.InkOnly;
			IC.AutoRedraw = false;
			IC.DynamicRendering = false;
			IC.EraserMode = InkOverlayEraserMode.StrokeErase;
			IC.CursorInRange += IC_CursorInRange;
			IC.MouseDown += IC_MouseDown;
			IC.MouseMove += IC_MouseMove;
			IC.MouseUp += IC_MouseUp;
			IC.CursorDown += IC_CursorDown;
			IC.Stroke += IC_Stroke;
			IC.DefaultDrawingAttributes.Width = 80;
			IC.DefaultDrawingAttributes.Transparency = 30;
			IC.DefaultDrawingAttributes.AntiAliased = true;

			cursorred = new System.Windows.Forms.Cursor(gInk.Properties.Resources.cursorred.Handle);
			//cursoryellow = new System.Windows.Forms.Cursor(gInk.Properties.Resources.cursoryellow.Handle);
			//cursorblue = new System.Windows.Forms.Cursor(gInk.Properties.Resources.cursorblue.Handle);
			IC.Cursor = cursorred;
			this.Cursor = cursorred;
			IC.Enabled = true;

			image_exit = new Bitmap(btStop.Width, btStop.Height);
			Graphics g = Graphics.FromImage(image_exit);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.exit, 0, 0, btStop.Width, btStop.Height);
			btStop.Image = image_exit;
			image_clear = new Bitmap(btClear.Width, btClear.Height);
			g = Graphics.FromImage(image_clear);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.garbage, 0, 0, btClear.Width, btClear.Height);
			btClear.Image = image_clear;
			image_undo = new Bitmap(btUndo.Width, btUndo.Height);
			g = Graphics.FromImage(image_undo);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.undo, 0, 0, btUndo.Width, btUndo.Height);
			btUndo.Image = image_undo;
			image_eraser_act = new Bitmap(btEraser.Width, btEraser.Height);
			g = Graphics.FromImage(image_eraser_act);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.eraser_act, 0, 0, btEraser.Width, btEraser.Height);
			image_eraser = new Bitmap(btEraser.Width, btEraser.Height);
			g = Graphics.FromImage(image_eraser);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.eraser, 0, 0, btEraser.Width, btEraser.Height);
			btEraser.Image = image_eraser;
			image_snap = new Bitmap(btSnap.Width, btSnap.Height);
			g = Graphics.FromImage(image_snap);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.snap, 0, 0, btSnap.Width, btSnap.Height);
			btSnap.Image = image_snap;
			image_dock = new Bitmap(btDock.Width, btDock.Height);
			g = Graphics.FromImage(image_dock);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.dock, 0, 0, btDock.Width, btDock.Height);
			image_dockback = new Bitmap(btDock.Width, btDock.Height);
			g = Graphics.FromImage(image_dockback);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.dockback, 0, 0, btDock.Width, btDock.Height);
			if (Root.Docked)
				btDock.Image = image_dockback;
			else
				btDock.Image = image_dock;

			image_pencil = new Bitmap(btPen3.Width, btPen3.Height);
			g = Graphics.FromImage(image_pencil);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.pencil, 0, 0, btPen3.Width, btPen3.Height);
			image_highlighter = new Bitmap(btPen3.Width, btPen3.Height);
			g = Graphics.FromImage(image_highlighter);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.highlighter, 0, 0, btPen3.Width, btPen3.Height);
			image_pencil_act = new Bitmap(btPen3.Width, btPen3.Height);
			g = Graphics.FromImage(image_pencil_act);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.pencil_act, 0, 0, btPen3.Width, btPen3.Height);
			image_highlighter_act = new Bitmap(btPen3.Width, btPen3.Height);
			g = Graphics.FromImage(image_highlighter_act);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.highlighter_act, 0, 0, btPen3.Width, btPen3.Height);

			image_pointer = new Bitmap(btPointer.Width, btPointer.Height);
			g = Graphics.FromImage(image_pointer);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.pointer, 0, 0, btPointer.Width, btPointer.Height);
			image_pointer_act = new Bitmap(btPointer.Width, btPointer.Height);
			g = Graphics.FromImage(image_pointer_act);
			g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
			g.DrawImage(global::gInk.Properties.Resources.pointer_act, 0, 0, btPointer.Width, btPointer.Height);

			btPen1.BackColor = Root.Pen1.Color;
			btPen2.BackColor = Root.Pen2.Color;
			btPen3.BackColor = Root.Pen3.Color;
			btPen4.BackColor = Root.Pen4.Color;
			btPen5.BackColor = Root.Pen5.Color;
			btPen1.FlatAppearance.MouseDownBackColor = Root.Pen1.Color;
			btPen2.FlatAppearance.MouseDownBackColor = Root.Pen2.Color;
			btPen3.FlatAppearance.MouseDownBackColor = Root.Pen3.Color;
			btPen4.FlatAppearance.MouseDownBackColor = Root.Pen4.Color;
			btPen5.FlatAppearance.MouseDownBackColor = Root.Pen5.Color;
			btPen1.FlatAppearance.MouseOverBackColor = Root.Pen1.Color;
			btPen2.FlatAppearance.MouseOverBackColor = Root.Pen2.Color;
			btPen3.FlatAppearance.MouseOverBackColor = Root.Pen3.Color;
			btPen4.FlatAppearance.MouseOverBackColor = Root.Pen4.Color;
			btPen5.FlatAppearance.MouseOverBackColor = Root.Pen5.Color;
			if (Root.Pen1.Transparency >= 100)
			{
				image_pen1 = image_highlighter;
				image_pen1_act = image_highlighter_act;
			}
			else
			{
				image_pen1 = image_pencil;
				image_pen1_act = image_pencil_act;
			}
			if (Root.Pen2.Transparency >= 100)
			{
				image_pen2 = image_highlighter;
				image_pen2_act = image_highlighter_act;
			}
			else
			{
				image_pen2 = image_pencil;
				image_pen2_act = image_pencil_act;
			}
			if (Root.Pen3.Transparency >= 100)
			{
				image_pen3 = image_highlighter;
				image_pen3_act = image_highlighter_act;
			}
			else
			{
				image_pen3 = image_pencil;
				image_pen3_act = image_pencil_act;
			}
			if (Root.Pen4.Transparency >= 100)
			{
				image_pen4 = image_highlighter;
				image_pen4_act = image_highlighter_act;
			}
			else
			{
				image_pen4 = image_pencil;
				image_pen4_act = image_pencil_act;
			}
			if (Root.Pen5.Transparency >= 100)
			{
				image_pen5 = image_highlighter;
				image_pen5_act = image_highlighter_act;
			}
			else
			{
				image_pen5 = image_pencil;
				image_pen5_act = image_pencil_act;
			}

			LastTickTime = DateTime.Parse("1987-01-01");
			tiSlide.Enabled = true;

			ToTransparent();
			ToTopMost();
		}
예제 #44
0
        public void Render(InkOverlay i, Graphics g)
        {
            int width = weight.ToString().Length*15;
            int height = 18;
            stroke.DrawingAttributes = i.DefaultDrawingAttributes.Clone();
            stroke.DrawingAttributes.Color = color;
            i.Renderer.Draw(g,stroke);

            Rectangle rect = StrokeManager.InkSpaceToPixelRect(i,g,stroke.GetBoundingBox());
            Point center = new Point(rect.X+rect.Width/2 - width/2, rect.Y+rect.Height/2 - height/2);
            g.FillRectangle(new SolidBrush(Color.White),center.X,center.Y,width, height);
            g.DrawString(weight.ToString(), new Font("Courier New",14, FontStyle.Bold),new SolidBrush(Color.Black), center);
        }
예제 #45
0
        //Necessary conversion for rendering strokes
        public static Rectangle InkSpaceToPixelRect(InkOverlay i, Graphics g, Rectangle rect)
        {
            Point ul = new Point(rect.Left,rect.Top);
            Point lr = new Point(rect.Right,rect.Bottom);
            Point[]	pts	= {	ul,	lr };
            i.Renderer.InkSpaceToPixel(g, ref pts);

            ul = pts[0]; lr	= pts[1];
            Rectangle r = new Rectangle(ul.X, ul.Y, lr.X-ul.X,	lr.Y-ul.Y);
            return r;
        }
        /// <summary>
        /// Form_Load event handler of the main capability form. This event
        /// handler initialize the main global variable, the InkOverlay and the UI.
        /// </summary>
        /// <param name="sender">The event sender object</param>
        /// <param name="e">The event arguments</param>
        private void PresentationCapabilityFMain_Load(object sender, System.EventArgs e)
        {
            this.statusBar.Font = UIFont.StatusFont;

            this.tbbPrevious.ToolTipText = Strings.PreviousSlide;
            this.tbbNext.ToolTipText = Strings.NextSlide;
            this.tbbInsertSlide.ToolTipText = Strings.InsertBlankSlide;
            this.tbbSnapshot.ToolTipText = Strings.InsertScreenShot;
            this.tbbPen.ToolTipText = Strings.Pen;
            this.tbbHighlighter.ToolTipText = Strings.Highlighter;
            this.tbbEraser.ToolTipText = Strings.Eraser;
            this.tbbEraseAll.ToolTipText = Strings.EraseAll;
            this.tbbOpenFile.ToolTipText = Strings.Open;
            this.tbbResend.ToolTipText = Strings.ResendCurrentSlide;
            this.miFile.Text = Strings.FileHotkey;
            this.miOpen.Text = Strings.OpenHotkey;
            this.miOpenRemote.Text = Strings.OpenRemote;
            this.miResendCurrentSlide.Text = Strings.ResendCurrentSlide;
            this.miSlideShow.Text = Strings.SlideShow;
            this.miClose.Text = Strings.CloseHotkey;
            this.miTools.Text = Strings.ToolsHotkey;
            this.miBlueInk.Text = Strings.BluePen;
            this.miBlackInk.Text = Strings.BlackPen;
            this.miRedInk.Text = Strings.RedPen;
            this.miYellowInk.Text = Strings.YellowPen;
            this.miYellowHighlighter.Text = Strings.YellowHighlighter;
            this.miLimeHighlighter.Text = Strings.LimeHighlighter;
            this.miBlueHighlighter.Text = Strings.BlueHighlighter;
            this.miErase.Text = Strings.Eraser;
            this.miEraseAllInk.Text = Strings.EraseAll;
            this.miSlide.Text = Strings.SlideHotkey;
            this.miBlankSlide.Text = Strings.InsertBlankSlide;
            this.miSnapshot.Text = Strings.SelectScreenShot;
            this.miInsertSnapshot.Text = Strings.InsertScreenShot;
            this.miPreviousSlide.Text = Strings.PreviousSlideHotkey;
            this.miNextSlide.Text = Strings.NextSlideHotkey;
            this.miHelp.Text = Strings.Help;
            this.miPresentationHelp.Text = Strings.PresentationHelp;
            this.miHelpAbout.Text = Strings.About;
            this.Text = Strings.PresentationCapabilityFMain;

            #region Initialize InkOverlay

            inkOverlay = new InkOverlay(pbRTDoc.Handle);

            // Hook up stroke added event
            inkOverlay.Stroke += new InkCollectorStrokeEventHandler(inkOverlay_Stroke);
            inkOverlay.StrokesDeleting += new InkOverlayStrokesDeletingEventHandler(inkOverlay_StrokesDeleting);

            // Hook up the NewInAirPackets event
            // Note: An in-air packet occurs when a user moves a pen near the tablet and the cursor 
            // is within the InkOverlay objects window or the user moves a mouse within the 
            // InkOverlay objects associated window. 
            // This will allow us to see if the pen is inverted meaning that the user is useing the eraser pen
            inkOverlay.CursorInRange += new InkCollectorCursorInRangeEventHandler(inkOverlay_CursorInRange);

            // Ink is actually the default editing mode, so the line
            // below is not required
            inkOverlay.EditingMode = InkOverlayEditingMode.Ink;

            // We're now set to go, so turn on tablet input
            inkOverlay.Enabled = true;

            // Link the inkOverlay of the inkToolBar control
            inkToolBar.InkOverlay = inkOverlay;

            #endregion Initialize InkOverlay

            #region Initialize UI
            
            // Hide/Show buttons and menus depending on the configuration settings
            // and Initiator capability or not

            // By default Open remote menu is invisible
            miOpenRemote.Visible = false;
            
            // If I am not the initiator, I won't be able to open a file
            if (!presentationCapability.IsSender)
            {
                // Remote user can not send anything other than ink and nav
                EnableSlideSend(false);
            } 
            else // Initiator
            {
                string setting;
                if ((setting = ConfigurationManager.AppSettings[AppConfig.PRES_OpenRemote]) != null)
                {
                    miOpenRemote.Visible = bool.Parse(setting);
                }
            }

            #endregion Initialize UI

            // Create the hashtable for page strokes
            hashtablePageStrokes = new Hashtable();

            this.pbRatio = (double)constHeightPageSend / (double)constWidthPageSend;

            // Disable the navigation button because we start in whiteboard mode
            // with ust one page
            // Pri2: Put all the UI init in one fct
            disableNavigationButtons();

            this.PerformDynamicLayout();

            // Set event handler for future orientation changes
            Microsoft.Win32.SystemEvents.DisplaySettingsChanged +=
                new System.EventHandler( displaySettingsChanged );

            // Set cursor to default and clear status message
            statusBar.SetReadyStatusMessage();
        }
예제 #47
0
        private void Form1_Load(object sender, EventArgs e)
        {
            inkOverlay = new InkOverlay();
            inkOverlay.Handle = this.Handle;
            inkOverlay.Enabled = true;
            inkOverlay.Gesture += new InkCollectorGestureEventHandler(Event_OnApplicationGesture);
            inkOverlay.CollectionMode = CollectionMode.InkAndGesture;
            inkOverlay.SetGestureStatus(ApplicationGesture.Left, true);
            inkOverlay.SetGestureStatus(ApplicationGesture.Right, true);
            inkOverlay.SetGestureStatus(ApplicationGesture.Up, true);
            inkOverlay.SetGestureStatus(ApplicationGesture.Down, true);
            inkOverlay.SetGestureStatus(ApplicationGesture.Check,true);

            // timer configuration
            timer1.Interval = 500;
            this.inkOverlay.Stroke += new InkCollectorStrokeEventHandler(Event_Stroke);
        }
        /// <summary>
        /// Form_Load event handler of the main capability form. This event
        /// handler initialize the main global variable, the InkOverlay and the UI.
        /// </summary>
        /// <param name="sender">The event sender object</param>
        /// <param name="e">The event arguments</param>
        private void PresentationCapabilityFMain_Load(object sender, System.EventArgs e)
        {
            #region Initialize InkOverlay

            inkOverlay = new InkOverlay(pbRTDoc.Handle);

            // Hook up stroke added event
            inkOverlay.Stroke += new InkCollectorStrokeEventHandler(inkOverlay_Stroke);
            inkOverlay.StrokesDeleting += new InkOverlayStrokesDeletingEventHandler(inkOverlay_StrokesDeleting);

            // Hook up the NewInAirPackets event
            // Note: An in-air packet occurs when a user moves a pen near the tablet and the cursor
            // is within the InkOverlay objects window or the user moves a mouse within the
            // InkOverlay objects associated window.
            // This will allow us to see if the pen is inverted meaning that the user is useing the eraser pen
            inkOverlay.CursorInRange += new InkCollectorCursorInRangeEventHandler(inkOverlay_CursorInRange);

            // Ink is actually the default editing mode, so the line
            // below is not required
            inkOverlay.EditingMode = InkOverlayEditingMode.Ink;

            // We're now set to go, so turn on tablet input
            inkOverlay.Enabled = true;

            // Link the inkOverlay of the inkToolBar control
            inkToolBar.InkOverlay = inkOverlay;

            #endregion Initialize InkOverlay

            #region Initialize UI

            // Hide/Show buttons and menus depending on the configuration settings
            // and Initiator capability or not

            // By default Open remote menu is invisible
            miOpenRemote.Visible = false;

            // If I am not the initiator, I won't be able to open a file
            if (!presentationCapability.IsSender)
            {
                // Remote user can not send anything other than ink and nav
                EnableSlideSend(false);
            }
            else // Initiator
            {
                string setting;
                if ((setting = ConfigurationManager.AppSettings[AppConfig.PRES_OpenRemote]) != null)
                {
                    miOpenRemote.Visible = bool.Parse(setting);
                }
            }

            #endregion Initialize UI

            // Create the hashtable for page strokes
            hashtablePageStrokes = new Hashtable();

            this.pbRatio = (double)constHeightPageSend / (double)constWidthPageSend;

            // Disable the navigation button because we start in whiteboard mode
            // with ust one page
            // Pri2: Put all the UI init in one fct
            disableNavigationButtons();

            this.PerformDynamicLayout();

            // Set event handler for future orientation changes
            Microsoft.Win32.SystemEvents.DisplaySettingsChanged +=
                new System.EventHandler( displaySettingsChanged );

            // Set cursor to default and clear status message
            statusBar.SetReadyStatusMessage();
        }
예제 #49
0
    public MainForm()
    {
        // Required for Windows Form Designer support.
        InitializeComponent();

        // Load our icon.
        this.Icon = new Icon(typeof(MainForm),"PhysicsIllustrator.ico");

        // Initialize the per-item smart tag.
        bodytag = new PhysicsIllustrator.SmartTag.SmartTag();
        bodytag.Image = Global.LoadImage("Resources.PenMenu.ico");
        bodytag.Visible = false;

        bodytag.ContextMenu = new ContextMenu();
        bodytag.ContextMenu.MenuItems.Add("Clone", new EventHandler(hover_EditCloneClicked));
        bodytag.ContextMenu.MenuItems.Add("Delete", new EventHandler(hover_EditDeleteClicked));
        bodytag.ContextMenu.MenuItems.Add("-");
        bodytag.ContextMenu.MenuItems.Add("Straighten", new EventHandler(hover_EditStraightenClicked));
        bodytag.ContextMenu.MenuItems.Add("Properties...", new EventHandler(hover_EditPropertiesClicked));

        this.Controls.Add(bodytag);

        // Go fullscreen.  Note: this works even with the taskbar set
        // to "keep on top of other windows".
        this.WindowState = System.Windows.Forms.FormWindowState.Normal;
        // this.Bounds = Screen.PrimaryScreen.Bounds;

        // Declare repaint optimizations.
        base.SetStyle(
            ControlStyles.UserPaint|
            ControlStyles.AllPaintingInWmPaint|
            ControlStyles.DoubleBuffer,
            true);

        // Init inkoverlay.
        inkoverlay = new InkOverlay(this.Handle,true);
        inkoverlay.CollectionMode = CollectionMode.InkOnly; // no gestures

        inkoverlay.AutoRedraw = false; // Dynamic rendering only; we do all the painting.

        DrawingAttributes da = new DrawingAttributes();
        da.AntiAliased = false;
        inkoverlay.DefaultDrawingAttributes = da;

        inkoverlay.Stroke += new InkCollectorStrokeEventHandler(inkoverlay_Stroke);

        inkoverlay.CursorInRange += new InkCollectorCursorInRangeEventHandler(inkoverlay_CursorInRange);
        inkoverlay.StrokesDeleting += new InkOverlayStrokesDeletingEventHandler(inkoverlay_StrokesDeleting);

        inkoverlay.SelectionChanging += new InkOverlaySelectionChangingEventHandler(inkoverlay_SelectionChanging);
        inkoverlay.SelectionChanged += new InkOverlaySelectionChangedEventHandler(inkoverlay_SelectionChanged);
        inkoverlay.SelectionMoved += new InkOverlaySelectionMovedEventHandler(inkoverlay_SelectionMoved);
        inkoverlay.SelectionResized += new InkOverlaySelectionResizedEventHandler(inkoverlay_SelectionResized);

        // inkoverlay.
        declaredmode = inkoverlay.EditingMode;

        // Spin up SDI model (ink+doc).
        doc = new MagicDocument();
        inkoverlay.Ink = doc.Ink;

        inkoverlay.Enabled = !DesignMode;

        inkoverlay.Ink.InkAdded += new StrokesEventHandler(inkoverlay_Ink_InkAdded);
    }
예제 #50
0
        private void WhiteBoardForm_Load(object sender, System.EventArgs e)
        {
            // Provide the InkOverlay with its drawing surface
            inkOverlay = new InkOverlay(pbInk);

            // Hook up stroke events
            inkOverlay.Stroke += new InkCollectorStrokeEventHandler(inkOverlay_Stroke);
            inkOverlay.StrokesDeleting += new InkOverlayStrokesDeletingEventHandler(inkOverlay_StrokesDeleting);
            inkOverlay.CursorInRange += new InkCollectorCursorInRangeEventHandler(inkOverlay_CursorInRange);

            // We're now set to go, so turn on tablet input
            inkOverlay.Enabled = true;

            // Link the inkOverlay to the inkToolBar control
            inkToolBar.InkOverlay = inkOverlay;
        }
예제 #51
0
파일: MainForm.cs 프로젝트: Farouq/semclone
        private void InitializeInk()
        {
            _overlay = new InkOverlay(pbImage, true);
            _overlay.DefaultDrawingAttributes.Width = 1;
            _overlay.DefaultDrawingAttributes.Color = Color.Red;
            _overlay.DefaultDrawingAttributes.IgnorePressure = true;

            // When a stroke is received, we start a timer that, when expiring,
            // will cause the image to be redrawn.  This timer allows the user
            // to draw multiple strokes without the image having to be redrawn
            // after each.
            _overlay.Stroke += delegate { StartRefreshTimer(); };

            // We also don't want the image to be redrawn midstroke (which
            // could happen if the user drew a stroke, causing the timer
            // to start, and then took longer than a second to draw the
            // second stroke), so when new packets are received, the timer
            // is stopped; it'll be restarted by the above when the Stroke
            // is completed.
            _overlay.NewPackets += delegate { tmRefresh.Stop(); };
        }
예제 #52
0
 public Edge(Node n1, Node n2, InkOverlay i)
     : this(n1,n2,i,Edge.DEFAULT_WEIGHT)
 {
 }
예제 #53
0
        public void Render(InkOverlay i, Graphics g)
        {
            if(stroke.Deleted == true) return;
            Rectangle rect = StrokeManager.InkSpaceToPixelRect(i, g, stroke.GetBoundingBox());
            if(isRect)
                g.FillRectangle(new SolidBrush(fillColor), rect);
            else
                g.FillEllipse(new SolidBrush(fillColor), rect);

            i.Renderer.Draw(g, stroke);
            Point[] p = {new Point(centerPoint.X, centerPoint.Y)};
            i.Renderer.InkSpaceToPixel(g, ref p);
            p[0].X -= 15;
            p[0].Y -= 10;
            g.DrawString(text, new Font("Arial",10), new SolidBrush(textColor), p[0]);
        }
예제 #54
0
        /// <summary>
        /// Event Handler from Form Load Event
        /// Setup the ink overlay for collection
        /// </summary>
        /// <param name="sender">The control that raised the event.</param>
        /// <param name="e">The event arguments.</param>
        private void InkDividerForm_Load(object sender, System.EventArgs e)
        {
            // Create the ink overlay and associate it with the form
            myInkOverlay = new Microsoft.Ink.InkOverlay(DrawArea.Handle);

            // Hook event handler for the Stroke event to myInkOverlay_Stroke.
            // This is necessary since the application needs to pass the strokes
            // to the ink divider.
            myInkOverlay.Stroke += new InkCollectorStrokeEventHandler(myInkOverlay_Stroke);

            // Hook the event handler for StrokeDeleting event to myInkOverlay_StrokeDeleting.
            // This is necessary as the application needs to remove the strokes from
            // ink divider object as well.
            myInkOverlay.StrokesDeleting += new InkOverlayStrokesDeletingEventHandler(myInkOverlay_StrokeDeleting);

            // Hook the event handler for StrokeDeleted event to myInkOverlay_StrokeDeleted.
            // This is necessary to update the layout analysis result when automatic layout analysis
            // option is selected.
            myInkOverlay.StrokesDeleted += new InkOverlayStrokesDeletedEventHandler(myInkOverlay_StrokeDeleted);

            // Create the ink divider object
            myInkDivider = new Divider();

            // Add a default recognizer context to the divider object
            // without adding the recognizer context, the divider would
            // not use a recognizer to do its word segmentation and would
            // have less accurate results.
            // Adding the recognizer context will slow down the call to
            // myInkDivider.Divide though.
            // It is possible that there is no recognizer installed on the
            // machine for this language. In that case the divider will
            // not use a recognizer to improve its accuracy.
            // Get the default recognizer if any
            try
            {
                Recognizers recognizers = new Recognizers();
                myInkDivider.RecognizerContext = recognizers.GetDefaultRecognizer().CreateRecognizerContext();
            }
            catch (InvalidOperationException)
            {
                //We are in the case where no default recognizers can be found
            }

            // The LineHeight property helps the InkDivider distinguish between
            // drawing and handwriting. The value should be the expected height
            // of the user's handwriting in ink space units (0.01mm).
            // Here we set the LineHeight to 840, which is about 1/3 of an inch.
            myInkDivider.LineHeight = 840;

            // Assign ink overlay's strokes collection to the ink divider
            // This strokes collection will be updated in the event handler
            myInkDivider.Strokes = myInkOverlay.Ink.Strokes;

            // Enable ink collection
            myInkOverlay.Enabled = true;

            // Set check for ink menu item
            miInk.Checked = true;
        }
예제 #55
0
		/// <summary>
		/// This C# example gets the bounds of all of the ink in the Ink object in pixel space, returning them in the out parameters as left, top, width, and height.
		/// </summary>
		/// <param name="left"></param>
		/// <param name="top"></param>
		/// <param name="width"></param>
		/// <param name="height"></param>
		/// <param name="theIC"></param>
		/// <param name="theHandle"></param>
		/// <remarks>From MSDN: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/tpcsdk10/html/reference/tbmthinkspacetopixel.asp </remarks>
		public void getBoundsFromInk(out int left, out int top, out int width, out int height, InkOverlay theIO)
		{
    
			// Copy the bounding rectangle in ink space dimensions
			System.Drawing.Rectangle inkRect = theIO.Ink.GetBoundingBox();

			// Load the top left and bottom right points
			System.Drawing.Point ptTL, ptBR;
			ptTL = ptBR = inkRect.Location;
			ptBR += inkRect.Size;

			Graphics g = CreateGraphics();

			// Find the edges of the bounding box in pixel space
			theIO.Renderer.InkSpaceToPixel(g, ref ptTL);
			theIO.Renderer.InkSpaceToPixel(g, ref ptBR);

			g.Dispose();

			// Copy the out parameters
			left = ptTL.X;
			top = ptTL.Y;
			width = ptBR.X - ptTL.X;
			height = ptBR.Y - ptTL.Y;
		}