コード例 #1
0
ファイル: Draw.cs プロジェクト: lupuscarnis/VoiceToPaint
        static private void DrawCircle(DrawObject args, Control control)
        {
            string type = args.Type, color = args.Color, point = args.Point + "", size = args.Size + "", rotation = args.Rotation + "";
            //create the object to draw
            Graphics graph = control.CreateGraphics();

            //Send it to the form
            Tools.getPen = new Pen(Commands.getColor(color));

            if ((size == null) || size.Equals("0"))
            {
                size = "20";
            }
            //Send it to the form
            graph.DrawPath(Tools.getPen, Shapes.Circle(point, size));
        }
コード例 #2
0
ファイル: Draw.cs プロジェクト: lupuscarnis/VoiceToPaint
        static public void Execute(string command, Control control)
        {
            string[] args = ExtractArgs(command);

            switch (args[1])
            {
            case "square":
            {
                DrawObject drawObject = new DrawObject(args[1], args[2], int.Parse(args[3]), int.Parse(args[4]), int.Parse(args[5]), command);

                DrawSquare(drawObject, control);
                //store the object in a sorted list
                int ListKeyMod = 0;
                do
                {
                    if (Tools.getObjects.ContainsKey(ListKeyMod))
                    {
                        ListKeyMod++;
                    }
                } while (Tools.getObjects.ContainsKey(ListKeyMod));

                drawObject.Id = ListKeyMod; Tools.getObjects.Add(ListKeyMod, drawObject);

                break;
            }

            case "circle":
            {
                DrawObject drawObject = new DrawObject(args[1], args[2], int.Parse(args[3]), int.Parse(args[4]), int.Parse(args[5]), command);


                DrawCircle(drawObject, control);
                int ListKeyMod = 0;
                do
                {
                    if (Tools.getObjects.ContainsKey(ListKeyMod))
                    {
                        ListKeyMod++;
                    }
                } while (Tools.getObjects.ContainsKey(ListKeyMod));

                drawObject.Id = ListKeyMod; Tools.getObjects.Add(ListKeyMod, drawObject);

                break;
            }

            case "triangle":
            {
                DrawObject drawObject = new DrawObject(args[1], args[2], int.Parse(args[3]), int.Parse(args[4]), int.Parse(args[5]), command);


                DrawTriangle(drawObject, control);
                int ListKeyMod = 0;
                do
                {
                    if (Tools.getObjects.ContainsKey(ListKeyMod))
                    {
                        ListKeyMod++;
                    }
                } while (Tools.getObjects.ContainsKey(ListKeyMod));

                drawObject.Id = ListKeyMod; Tools.getObjects.Add(ListKeyMod, drawObject);

                break;
            }
            }
        }