Click here to Skip to main content
15,879,535 members
Articles / Containers / Docker

SVG Artiste - An SVG Editor

Rate me:
Please Sign up or sign in to vote.
4.69/5 (23 votes)
3 Aug 2010CPOL14 min read 95.7K   15.4K   93  
A Vector based tool to create and edit SVG images
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SVGEditor2.Tools.ToolBoxes
{
    public partial class ToolBox : Form
    {
        public String ToolSelection = "";

        // Declare the delegate (if using non-generic pattern).
        public delegate void ToolSelectionChangedEventHandler(object sender, EventArgs e);

        // Declare the event.
        public event ToolSelectionChangedEventHandler ToolSelectionChanged;


        public ToolBox()
        {
            InitializeComponent();
        }

        private void radioButton_CheckedChanged(object sender, EventArgs e)
        {
            String ToolSelected = ((RadioButton)(sender)).Name;

            if (!((RadioButton)(sender)).Checked)
                return;

            switch (ToolSelected)
            {
                case "radioButton_Pointer":
                    ToolSelection = "Pointer";
                    break;
                case "radioButton_rectangle":
                    ToolSelection = "Rectangle";
                        break;
                case "radioButton_line":
                    ToolSelection = "Line";
                    break;
                case "radioButton_ellipse":
                    ToolSelection = "Ellipse";
                    break;
                case "radioButton_pan":
                    ToolSelection = "Pan";
                    break;
                case "radioButton_pencil":
                    ToolSelection = "Pencil";
                    break;
                case "radioButton_text":
                    ToolSelection = "Text";
                    break;
                case "radioButton_path":
                    ToolSelection = "Path";
                    break;
                case "radioButton_image":
                    ToolSelection = "Image";
                    break;
            }

            if (ToolSelectionChanged != null)
                ToolSelectionChanged(ToolSelection, null);   
        }

        public void SetToolSelection(DrawTools.DrawArea.DrawToolType tool)
        {
            switch (tool)
            {
                case DrawTools.DrawArea.DrawToolType.Pointer:
                    radioButton_Pointer.Checked = true;
                    break;
                case DrawTools.DrawArea.DrawToolType.Ellipse:
                    radioButton_ellipse.Checked = true;
                    break;
                case DrawTools.DrawArea.DrawToolType.Rectangle:
                    radioButton_rectangle.Checked = true;
                    break;
                case DrawTools.DrawArea.DrawToolType.Line:
                    radioButton_line.Checked = true;
                    break;
                case DrawTools.DrawArea.DrawToolType.Pan:
                    radioButton_pan.Checked = true;
                    break;
                case DrawTools.DrawArea.DrawToolType.Polygon:
                    radioButton_pencil.Checked = true;
                    break;
                default:
                    radioButton_Pointer.Checked = true;
                    break;
            }
        }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

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


Written By
Engineer
Singapore Singapore
He is a Microsoft technology enthusiast, who wish to create applications which others find useful.He loves making small tools and getting involved in architecting bigger systems.

He is currently working as a professional developer in a software development firm in .Net technologies.

He likes reading technical blogs, contributing to opensource and most importantly, enjoying life.

His ambition is to be an impressive software maker.

Comments and Discussions