Click here to Skip to main content
15,891,629 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have the following code to find the coordinates of all the strokes in inkcanvas.
C#
private string GetAllPoints(InkCanvas oInkCanvas)
        {
            int iS = -1;
            int iP;
            string sP = "";
            string s = "";
            string r = "\r\n";

            System.Windows.Input.StylusPointCollection colStylusPoints;
            foreach (Stroke oS in oInkCanvas.Strokes)
            {
                iP = -1;
              
                // Header for each Stroke.
        

                if (oS.DrawingAttributes.FitToCurve == true)
                {

                    colStylusPoints = oS.GetBezierStylusPoints();
                    foreach (StylusPoint oPoint in colStylusPoints)
                    {
                        iP += 1;
                        s +=((int)oPoint.X).ToString() + "\t" +
                        ((int)oPoint.Y).ToString() + r;
                    }
                }

                else
                {

                    colStylusPoints = oS.StylusPoints;
                    foreach (StylusPoint oPoint in colStylusPoints)
                    {
                        iP += 1;
                        s += 
                        ((int)oPoint.X).ToString() + "\t" +
                        ((int)oPoint.Y).ToString() + r;
                    }
                }
            }
            return s;
        }

Actually i need to find the coordinates of the current stroke i have drawn and not the coordinates of the previous strokes on inkcanvas.

How do i make the modifications?
Posted
Updated 14-Apr-13 4:08am
v2
Comments
sankar4567 12-Jun-13 5:28am    
I think U can use getbounds() function of stroke object to get the coordinates of the inkcanvas strokes

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900