Beispiel #1
0
 public SchetsElement(ISchetsTool t_soort, Point t_beginpunt, Point t_eindpunt, Color t_kleur)
 {
     soort     = t_soort;
     beginpunt = t_beginpunt;
     eindpunt  = t_eindpunt;
     kleur     = t_kleur;
 }
Beispiel #2
0
 public SchetsElement(ISchetsTool t_soort, Point t_beginpunt, Color t_kleur)
 {
     soort     = t_soort;
     beginpunt = t_beginpunt;
     kleur     = t_kleur;
     penpunten = new List <Point>();
 }
Beispiel #3
0
        private void clickToolMenu(object obj, EventArgs ea)
        {
            var tool = (ISchetsTool)((ToolStripMenuItem)obj).Tag;

            this.currentTool = tool;
            mRadioButtons[tool].PerformClick();
        }
Beispiel #4
0
 public SchetsElement(ISchetsTool t_soort, Point t_beginpunt, Color t_kleur, string t_tekst)
 {
     soort     = t_soort;
     beginpunt = t_beginpunt;
     kleur     = t_kleur;
     tekst     = t_tekst;
 }
        public SchetsWin()
        {
            ISchetsTool[] deTools = { new PenTool(),
                                      new LijnTool(),
                                      new RechthoekTool(),
                                      new VolRechthoekTool(),
                                      new EllipseTool(),
                                      new FilledEllipseTool(),
                                      new TekstTool(),
                                      new GumTool(),
                                      new MoveTool() };
            String[] deKleuren = { "Black", "White", "Red", "Green", "Blue"
                                 , "Yellow", "Magenta", "Cyan", "Other"
                                 };

            this.ClientSize = new Size(780, 575);
            huidigeTool = deTools[0];

            schetscontrol = new SchetsControl();
            schetscontrol.Location = new Point(64, 10);
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
                                       {
                                           if(mea.Button != MouseButtons.Left) return;
                                           vast = true;
                                           huidigeTool.MuisVast(schetscontrol, mea.Location);
                                       };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
                                       {
                                           if(vast)
                                               huidigeTool.MuisDrag(schetscontrol, mea.Location);
                                       };
            schetscontrol.MouseUp += (object o, MouseEventArgs mea) =>
                                       {
                                           if(mea.Button != MouseButtons.Left)
                                           {
                                               if(!vast)
                                                   showContextMenu(mea.Location);
                                               return;
                                           }
                                           vast = false;
                                           huidigeTool.MuisLos(schetscontrol, mea.Location);
                                       };
            schetscontrol.KeyPress += (object o, KeyPressEventArgs kpea) =>
                                       {
                                           huidigeTool.Letter(schetscontrol, kpea.KeyChar);
                                       };
            this.Controls.Add(schetscontrol);

            menuStrip = new MenuStrip();
            menuStrip.Visible = false;
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu(deKleuren);
            this.maakToolButtons(deTools);
            this.maakAktieButtons(deKleuren);
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
            this.FormClosing += SchetsWin_FormClosing;
        }
Beispiel #6
0
      private void selectTool(String soort)
      {
          List <string> soortenlist = new List <string>(new string[] { "pen", "lijn", "kader", "vlak", "ovaal", "ovaalvol", "tekst", "gum" });
          int           index       = soortenlist.IndexOf(soort);

          huidigeTool = deTools[index];
      }
 public TekenElement(ISchetsTool tool, Point beginPunt, Point eindPunt, Brush kwast, char c)
 {
     this.beginPunt = beginPunt;
     this.eindPunt  = eindPunt;
     this.kwast     = kwast;
     this.tool      = tool;
     this.c         = c;
 }
Beispiel #8
0
        public SchetsWin(StreamReader sr = null)
        {
            ISchetsTool[] deTools = { new PenTool()
                                      , new LijnTool()
                                      , new RechthoekTool()
                                      , new VolRechthoekTool()
                                      , new CirkelTool()
                                      , new GevuldeCirkelTool()
                                      , new TekstTool()
                                      , new GumTool()
                                      , new LagenTool() };
            String[]      deKleuren = { "Black", "Red",    "Green", "Blue"
                                        ,             "Yellow", "Magenta", "Cyan" };

            this.ClientSize      = new Size(700, 600);
            this.BackColor       = Color.FromArgb(40, 40, 40);
            this.FormBorderStyle = FormBorderStyle.SizableToolWindow;
            huidigeTool          = deTools[0];

            schetscontrol = new SchetsControl {
                Location = new Point(64, 10)
            };
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
            { vast = true;
              huidigeTool.MuisVast(schetscontrol, mea.Location); };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
            { if (vast)
              {
                  huidigeTool.MuisDrag(schetscontrol, mea.Location);
              }
            };
            schetscontrol.MouseUp += (object o, MouseEventArgs mea) =>
            { if (vast)
              {
                  huidigeTool.MuisLos(schetscontrol, mea.Location);
              }
              vast = false; };
            schetscontrol.KeyPress += (object o, KeyPressEventArgs kpea) =>
            { huidigeTool.Letter(schetscontrol, kpea.KeyChar); };
            this.Controls.Add(schetscontrol);

            menuStrip = new MenuStrip {
                Visible = false
            };
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu(deKleuren);
            this.maakToolButtons(deTools);
            this.maakAktieButtons(deKleuren);
            if (sr != null)
            {
                schetscontrol.Openen(sr);
            }
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
        }
Beispiel #9
0
        public SchetsWin()
        {
            ISchetsTool[] deTools = { new PenTool()
                                    , new LijnTool()
                                    , new RechthoekTool()
                                    , new CirkelTool()
                                    , new VolCirkelTool()
                                    , new VolRechthoekTool()
                                    , new TekstTool()
                                    , new GumTool()
                                    };
            String[] deKleuren = { "Black", "Red", "Green", "Blue"
                                 , "Yellow", "Magenta", "Cyan"
                                 };

            this.ClientSize = new Size(700, 549);
            huidigeTool = deTools[0];

            schetscontrol = new SchetsControl();
            schetscontrol.Location = new Point(64, 10);
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
                                       { veranderd = true; };
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
                                       {
                                           vast = true;
                                           huidigeTool.MuisVast(schetscontrol, mea.Location);
                                       };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
                                       {
                                           if (vast)
                                               huidigeTool.MuisDrag(schetscontrol, mea.Location);
                                       };
            schetscontrol.MouseUp += (object o, MouseEventArgs mea) =>
                                     {
                                         if (vast)
                                             huidigeTool.MuisLos(schetscontrol, mea.Location);
                                         vast = false;
                                     };
            schetscontrol.KeyPress += (object o, KeyPressEventArgs kpea) =>
                                      {
                                          huidigeTool.Letter(schetscontrol, kpea.KeyChar);
                                      };
            this.Controls.Add(schetscontrol);

            menuStrip = new MenuStrip();
            menuStrip.Visible = false;
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakActieMenu(deKleuren);
            this.maakToolButtons(deTools);
            this.maakActieButtons(deKleuren);
            this.Resize += this.veranderAfmeting;
            this.FormClosing += this.Afsluitvrager;
            this.veranderAfmeting(null, null);
        }
Beispiel #10
0
        private void initialiseerControls()
        {
            ISchetsTool[] deTools = { new PenTool()
                                      , new LijnTool()
                                      , new OvaalTool()
                                      , new VolOvaalTool()
                                      , new RechthoekTool()
                                      , new VolRechthoekTool()
                                      , new TekstTool()
                                      , new GumTool()
                                      , new VerplaatsTool() };

            huidigeTool = deTools[0];

            schetscontrol.Location   = new Point(64, 10);
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
            {
                vast = true;
                huidigeTool.MuisVast(schetscontrol, mea.Location);
            };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
            {
                if (vast)
                {
                    huidigeTool.MuisDrag(schetscontrol, mea.Location);
                }
            };
            schetscontrol.MouseUp += (object o, MouseEventArgs mea) =>
            {
                if (vast)
                {
                    huidigeTool.MuisLos(schetscontrol, mea.Location);
                }
                vast = false;
            };
            schetscontrol.KeyPress += (object o, KeyPressEventArgs kpea) =>
            {
                huidigeTool.Letter(schetscontrol, kpea.KeyChar);
            };
            this.Controls.Add(schetscontrol);

            schetscontrol.KeyDown += schetscontrol_KeyDown;

            menuStrip         = new MenuStrip();
            menuStrip.Visible = false;
            this.BackColor    = Color.White;
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu();
            this.maakToolButtons(deTools);
            this.maakAktieButtons();
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
        }
Beispiel #11
0
        public SchetsWin()
        {
            ISchetsTool[] deTools = { new PenTool()
                                      , new LijnTool()
                                      , new RechthoekTool()
                                      , new VolRechthoekTool()
                                      , new CircleTool()
                                      , new VolCircleTool()
                                      , new TekstTool()
                                      , new GumTool() };
            String[]      deKleuren = { "Black", "Red",    "Green", "Blue"
                                        ,             "Yellow", "Magenta", "Cyan" };

            this.ClientSize = new Size(700, 500);
            huidigeTool     = deTools[0];

            schetscontrol            = new SchetsControl();
            schetscontrol.Location   = new Point(64, 10);
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
            {
                vast = true;
                huidigeTool.MuisVast(schetscontrol, mea.Location);
            };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
            {
                if (vast)
                {
                    huidigeTool.MuisDrag(schetscontrol, mea.Location);
                }
            };
            schetscontrol.MouseUp += (object o, MouseEventArgs mea) =>
            {
                if (vast)
                {
                    huidigeTool.MuisLos(schetscontrol, mea.Location);
                }
                vast = false;
            };
            schetscontrol.KeyPress += (object o, KeyPressEventArgs kpea) =>
            {
                huidigeTool.Letter(schetscontrol, kpea.KeyChar);
            };
            this.Controls.Add(schetscontrol);

            menuStrip         = new MenuStrip();
            menuStrip.Visible = false;
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu(deKleuren);
            this.maakToolButtons(deTools);
            this.maakAktieButtons(deKleuren);
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
        }
Beispiel #12
0
 private void clickToolButton(object obj, EventArgs ea)
 {
     foreach (ToolStripButton b in mRadioButtons.Values)
     {
         if (b != obj)
         {
             b.Checked = false;
         }
     }
     this.currentTool = (ISchetsTool)((ToolStripButton)obj).Tag;
 }
Beispiel #13
0
        public SchetsWin()
        {
            ISchetsTool[] deTools = { new PenTool()
                                    , new LijnTool()
                                    , new RechthoekTool()
                                    , new VolRechthoekTool()
                                    , new TekstTool()
                                    , new GumTool()
                                    , new OvaalTool()
                                    , new VolOvaalTool()
                                    , new VerplaatsTool()

                                    };

            this.ClientSize = new Size(750, 600);
            huidigeTool = deTools[0];

            schetscontrol = new SchetsControl();
            schetscontrol.Location = new Point(109, 10);
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
                                       {
                                           vast = true;
                                           huidigeTool.MuisVast(schetscontrol, mea.Location);
                                       };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
                                       {
                                           if (vast)
                                               huidigeTool.MuisDrag(schetscontrol, mea.Location);
                                       };
            schetscontrol.MouseUp += (object o, MouseEventArgs mea) =>
                                     {
                                         if (vast)
                                             huidigeTool.MuisLos(schetscontrol, mea.Location);
                                         vast = false;
                                     };
            schetscontrol.KeyPress += (object o, KeyPressEventArgs kpea) =>
                                      {
                                          huidigeTool.Letter(schetscontrol, kpea.KeyChar);
                                      };
            this.Controls.Add(schetscontrol);

            menuStrip = new MenuStrip();
            menuStrip.Visible = false;
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu();
            this.maakToolButtons(deTools);
            this.maakAktieButtons();
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
        }
        public SchetsWin()
        {
            ISchetsTool[] deTools = { new PenTool()
                                      , new LijnTool()
                                      , new RechthoekTool()
                                      , new VolRechthoekTool()
                                      , new CirkelTool()
                                      , new VolCirkelTool()
                                      , new TekstTool()
                                      , new GumTool() };

            this.ClientSize = new Size(700, 500);
            huidigeTool     = deTools[0];

            schetscontrol          = new SchetsControl();
            schetscontrol.Location = new Point(64, 10);
            schets                   = schetscontrol.Schets;
            schets.Changed           = false;
            this.FormClosing        += afsluitenx;
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
            { vast = true;
              huidigeTool.MuisVast(schetscontrol, mea.Location); };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
            { if (vast)
              {
                  huidigeTool.MuisDrag(schetscontrol, mea.Location);
              }
            };
            schetscontrol.MouseUp += (object o, MouseEventArgs mea) =>
            { if (vast)
              {
                  huidigeTool.MuisLos(schetscontrol, mea.Location);
              }
              vast = false; };
            schetscontrol.KeyPress += (object o, KeyPressEventArgs kpea) =>
            { huidigeTool.Letter(schetscontrol, kpea.KeyChar); };
            this.Controls.Add(schetscontrol);

            menuStrip         = new MenuStrip();
            menuStrip.Visible = false;
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu();
            this.maakToolButtons(deTools);
            this.maakAktieButtons();
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
        }
Beispiel #15
0
        public SchetsWin()
        {
            this.ClientSize = new Size(700, 600);
            huidigeTool = deTools[0];

            schetscontrol = new SchetsControl();
            schetscontrol.Location = new Point(64, 10);
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
                                       {   vast=true;
                                           huidigeTool.MuisVast(schetscontrol, mea.Location);
                                       };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
                                       {   if (vast)
                                           huidigeTool.MuisDrag(schetscontrol, mea.Location);
                                       };
            schetscontrol.MouseUp   += (object o, MouseEventArgs mea) =>
                                       {   if (vast)
                                           huidigeTool.MuisLos (schetscontrol, mea.Location);
                                           vast = false;
                                       };
            schetscontrol.KeyPress +=  (object o, KeyPressEventArgs kpea) =>
                                       {   huidigeTool.Letter  (schetscontrol, kpea.KeyChar);
                                       };
            this.Controls.Add(schetscontrol);

            menuStrip = new MenuStrip();
            menuStrip.Visible = false;
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakEditMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu();
            this.maakToolButtons(deTools);
            this.maakAktieButtons();
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
        }
 public TekenElement(ISchetsTool tool, Point beginPunt, Point eindPunt, Brush kwast, char c, int rotatie)
     : this(tool, beginPunt, eindPunt, kwast, c)
 {
     this.rotatie = rotatie;
 }
Beispiel #17
0
 private void klikToolButton(object obj, EventArgs ea)
 {
     this.huidigeTool = (ISchetsTool)((RadioButton)obj).Tag;
 }
Beispiel #18
0
 public void voegtoeAanLijst(ISchetsTool t_huidigetool, Point t_beginpunt, Color t_kleur)
 {
     schetslijst.Add(new SchetsElement(t_huidigetool, t_beginpunt, t_kleur));
 }
Beispiel #19
0
 /// <summary>
 /// Voert de selectie van een nieuwe tool via een knop uit
 /// </summary>
 private void klikToolButton(object obj, EventArgs ea)
 {
     this.huidigeTool.Finalize(schetscontrol);
     this.huidigeTool = (ISchetsTool)((RadioButton)obj).Tag;
 }
Beispiel #20
0
 private void klikToolMenu(object obj, EventArgs ea)
 {
     this.huidigeTool = (ISchetsTool)((ToolStripMenuItem)obj).Tag;
 }
Beispiel #21
0
        public static Acties LaadActies(string filename, ISchetsTool[] tools, out Size fbs)
        {
            ISchetsTool huidigetool;
            huidigetool = tools[0];
            string line;
            string[] size;
            int width, height;
            Acties a = new Acties();

            StreamReader r = new StreamReader(filename);

            //Eerste regel is bitmapopvang, lees uit
            size = r.ReadLine().Split(',');
            int.TryParse(size[0], out width);
            int.TryParse(size[1], out height);
            fbs = new Size(width, height);

            while((line = r.ReadLine()) != null)
            {
                int argb;
                Color kleur;
                Point p;

                string[] parameters = line.Split(' ');
                //Bindt d.m.v. het checken van de ToString de juiste tool aan het element
                foreach(ISchetsTool tool in tools)
                    if (tool.ToString() == parameters[0])
                        huidigetool = tool;

                //Parse de kleur, val terug op zwart als het misgaat
                if (int.TryParse(parameters[1], out argb))
                    kleur = Color.FromArgb(argb);
                else
                    kleur = Color.Black;

                //Afhankelijk van het type moeten andere eigenschappenvolgordes worden aangehouden
                switch(parameters[0])
                {
                    case "tekst":
                        p = LeesPunt(parameters[3]);
                        a.AddElement(huidigetool, p, kleur);
                        a.AddTekst(parameters[2]);
                        break;
                    case "pen":
                        p = LeesPunt(parameters[2]);
                        a.AddElement(huidigetool, p, kleur);
                        a.AddEind(LeesPunt(parameters[3]));
                        for (int i = 4; i < parameters.Length; i++)
                        {
                            a.AddBegin(LeesPunt(parameters[i]));
                            i++;
                            a.AddEind(LeesPunt(parameters[i]));
                        }
                        break;
                    default:
                        p = LeesPunt(parameters[2]);
                        a.AddElement(huidigetool, p, kleur);
                        a.AddEind(LeesPunt(parameters[3]));
                        break;
                }
            }
            r.Close();
            return a;
        }
Beispiel #22
0
        /// <summary>
        /// Maakt een nieuw venster met een tekening
        /// </summary>
        public SchetsWin()
        {
            ISchetsTool[] deTools = { new TwoDimensionalTool <Line>()
                                      , new PencilTool()
                                      , new TwoDimensionalTool <FullRectangle>()
                                      , new TwoDimensionalTool <LineRectangle>()
                                      , new TwoDimensionalTool <FullCircle>()
                                      , new TwoDimensionalTool <LineCircle>()
                                      , new TekstTool()
                                      , new GumTool()
                                      , new SortTool()
                                      {
                                          directionUp = true
                                      }
                                      , new SortTool()
                                      {
                                          directionUp = false
                                      }
                                      , new BucketTool() };

            this.ClientSize  = new Size(700, 600);
            this.WindowState = FormWindowState.Maximized;
            huidigeTool      = deTools[0];

            schetscontrol            = new SchetsControl();
            schetscontrol.Location   = new Point(64, 10);
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
            {
                vast           = true;
                unsavedChanges = true;
                huidigeTool.MuisVast(schetscontrol, mea.Location);
            };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
            {
                if (vast)
                {
                    huidigeTool.MuisDrag(schetscontrol, mea.Location);
                }
            };
            schetscontrol.MouseUp += (object o, MouseEventArgs mea) =>
            {
                if (vast)
                {
                    huidigeTool.MuisLos(schetscontrol, mea.Location);
                    unsavedChanges = true;
                }
                vast = false;
            };
            schetscontrol.KeyPress += (object o, KeyPressEventArgs kpea) =>
            {
                unsavedChanges = true;
                huidigeTool.Letter(schetscontrol, kpea.KeyChar);
            };
            this.Controls.Add(schetscontrol);

            menuStrip         = new MenuStrip();
            menuStrip.Visible = false;
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu();
            this.maakToolButtons(deTools);
            this.maakAktieButtons();
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
        }
Beispiel #23
0
 private void klikToolButton(object obj, EventArgs ea)
 {
     this.huidigeTool = (ISchetsTool)((RadioButton)obj).Tag;
 }
Beispiel #24
0
 private void klikToolMenu(object obj, EventArgs ea)
 {
     this.huidigeTool = (ISchetsTool)((ToolStripMenuItem)obj).Tag;
 }
Beispiel #25
0
        //Functie die een schets inlaad
        public bool OpenSchets(ISchetsTool[] tools)
        {
            Size filebitmapsize;
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Filter = "Schetsen|*.txt";

            if (ofd.ShowDialog() == DialogResult.OK)
            {
                acties = ActiesFile.LaadActies(ofd.FileName, tools, out filebitmapsize);
                schets.VeranderAfmeting(filebitmapsize);
                RedrawFromActions();
                return true;
            }
            return false;
        }
Beispiel #26
0
 //Maak een nieuw element aan en voeg hem toe aan de lijst
 public void AddElement(ISchetsTool t, Point p, Color c)
 {
     elementen.Add(new Element(t, p, c));
 }
 private void setTool(ISchetsTool newTool)
 {
     huidigeTool.ToolChange(schetscontrol);
     huidigeTool = newTool;
     huidigeTool.ToolSelected(schetscontrol);
 }
        private Bitmap overlayBitmap; //Declareren overlayBitmap die later gebruikt wordt

        #endregion Fields

        #region Constructors

        public SchetsControl(string imageName)
        {
            schets = new Schets(imageName, new Size(600, 500)); //Aanmaken van nieuw schetsobject

            currentTool = App.availableTools[0];    //Zeggen dat currentTool een pen is (standaard bij openen)
            currentAction = new PenAction();    //Ook gelijk de penAction hierbij aanroepen

            this.DoubleBuffered = true; //Voorkomen van flikkeren van scherm tijdens tekenen

            this.Paint += this.teken;
            this.Resize += this.veranderAfmeting;

            this.MouseDown += (object o, MouseEventArgs mea) =>
            {
                isDirty = true;
                muisVast = true;    //Zeggen dat muisVast true is, zodra je muis indrukt

                overlayBitmap = new Bitmap(schets.imageSize.Width, schets.imageSize.Height);    //Zetten van overlayBitmap met de width en height
                setAction();

                Point translatedPoint = translateMouseCoordinates(mea.Location);    //Pak de muis-coördinaten

                currentTool.MuisVast(this, translatedPoint);    //Gebruiken muiscoördinaten bij aanroepen methode muisVast
                currentAction.onMouseDown(this, translatedPoint.X, translatedPoint.Y, 3, schets.primaryColor);
            };
            this.MouseMove += (object o, MouseEventArgs mea) =>
            {
                if (muisVast)   //Doe dit alleen indien muis is ingedrukt
                {
                    Point translatedPoint = translateMouseCoordinates(mea.Location);    //Houdt telkens bij welke punten je over gaat

                    currentTool.MuisDrag(this, translatedPoint);    //Aanroepen methode muisdrag met deze muiscoördinaten
                    currentAction.onMouseMove(translatedPoint.X, translatedPoint.Y);
                }
            };
            this.MouseUp += (object o, MouseEventArgs mea) =>
            {
                muisVast = false;   //Boolean muisVast op false zetten aangezien muis nu los is

                Point translatedPoint = translateMouseCoordinates(mea.Location);    //Bekijken op welke coördinaten dit gebeurde

                currentTool.MuisLos(this, translatedPoint);     //Aanroepen methode muislos met deze coördinaten
                if (currentAction != null)  //Indien er een action was gebruikt voeg dit dan toe aan de action list en update de historyBox
                {
                    currentAction.onMouseUp(translatedPoint.X, translatedPoint.Y);
                    App.currentSchetsWindow.currentSchetsControl.schets.actions.Add(App.currentSchetsWindow.currentSchetsControl.currentAction);
                    App.historyWindow.updateHistoryList();
                }
            };
            this.KeyPress += (object o, KeyPressEventArgs kpea) =>
            {
                if (kpea.KeyChar > 32)
                {
                    currentTool.Letter(this, kpea.KeyChar);
                    if (currentAction is TextAction)
                    {
                        ((TextAction)currentAction).enteredText += kpea.KeyChar;    //Voeg de letter toe aan de enteredTExt indien het textAction was
                    }
                }
            };
        }
Beispiel #29
0
        public SchetsWin()
        {
            InitializeComponent();
            ISchetsTool[] mTools = { new PenTool()
                                     ,                   new LijnTool()
                                     ,                   new RechthoekTool()
                                     ,                   new VolRechthoekTool()
                                     ,                   new EllipseTool()
                                     ,                   new FillEllipse()
                                     ,                   new TekstTool()
                                     ,                   new GumTool(),
                                     new MoveUpTool(),
                                     new MoveDownTool(),
                                     new DragTool() };

            this.ClientSize = new Size(800, 625);
            currentTool     = mTools[0];

            schetsControl            = new SchetsControl();
            schetsControl.Location   = new Point(64 + 10, 10);
            schetsControl.MouseDown +=
                (o, mea) =>
            {
                vast = true;
                currentTool.MouseDown(schetsControl, mea.Location);
            };
            schetsControl.MouseMove +=
                (o, mea) =>
            {
                if (vast)
                {
                    currentTool.MouseDrag(schetsControl, mea.Location);
                }
            };
            schetsControl.MouseUp +=
                (o, mea) =>
            {
                if (vast)
                {
                    currentTool.MouseUp(schetsControl, mea.Location);
                }
                vast = false;
            };
            schetsControl.KeyPress +=
                (o, kpea) =>
            {
                currentTool.Letter(schetsControl, kpea.KeyChar);
            };
            this.Controls.Add(schetsControl);

            menuStrip         = new MenuStrip();
            menuStrip.Visible = false;
            this.Controls.Add(menuStrip);
            this.makeFileMenu();
            this.makeToolMenu(mTools);
            this.makeActionMenu();
            this.makeToolButtons(mTools);
            this.makeActionButtons();
            this.Resize += this.sizeChange;
            this.sizeChange(null, null);
            FormClosing += SchetsWin_FormClosing;
            schetsControl.Schets.AcknowledgeChanges();
        }
Beispiel #30
0
        public SchetsWin()
        {
            ISchetsTool[] deTools = { new PenTool()
                                      , new LijnTool()
                                      , new RechthoekTool()
                                      , new VolRechthoekTool()
                                      , new TekstTool()
                                      , new GumTool()
                                      , new CirkelTool()
                                      , new VolCirkelTool() };

            List <string> deKleuren = new List <string>();

            foreach (PropertyInfo p in typeof(Color).GetProperties())
            {
                if (p.PropertyType.FullName == "System.Drawing.Color")
                {
                    deKleuren.Add(p.Name);
                }
            }

            int[] Diktes = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 20 };

            this.ClientSize = new Size(700, 520);
            huidigeTool     = deTools[0];

            schetscontrol           = new SchetsControl();
            schetscontrol.Location  = new Point(64, 10);
            schetscontrol.BackColor = Color.White;               //!!

            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
            {
                vast = true;
                huidigeTool.MuisVast(schetscontrol, mea.Location);
            };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
            {
                if (vast)
                {
                    huidigeTool.MuisDrag(schetscontrol, mea.Location);
                }
            };
            schetscontrol.MouseUp += (object o, MouseEventArgs mea) =>
            {
                if (vast)
                {
                    huidigeTool.MuisLos(schetscontrol, mea.Location);
                }
                vast = false;
            };
            schetscontrol.KeyPress += (object o, KeyPressEventArgs kpea) =>
            {
                huidigeTool.Letter(schetscontrol, kpea.KeyChar);
            };
            this.Controls.Add(schetscontrol);

            menuStrip         = new MenuStrip();
            menuStrip.Visible = true;
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu(deKleuren, Diktes);          //!
            this.maakToolButtons(deTools);
            this.maakAktieButtons(deKleuren, Diktes);       //!
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
        }
Beispiel #31
0
        public SchetsWin()
        {
            ISchetsTool[] deTools = { new PenTool()
                                      , new LijnTool()
                                      , new RechthoekTool()
                                      , new VolRechthoekTool()
                                      , new EllipsTool()
                                      , new VolEllipsTool()
                                      , new TekstTool()
                                      , new GumTool() };
            String[]      deKleuren = { "Black", "Red",    "Green",   "Blue"
                                        ,             "Yellow", "Magenta", "Cyan", "White" };

            this.ClientSize = new Size(700, 500);
            huidigeTool     = deTools[0];

            schetscontrol            = new SchetsControl();
            schetscontrol.Location   = new Point(64, 10);
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) => {
                vast = true;
                huidigeTool.MuisVast(schetscontrol, mea.Location);
                if (huidigeTool != deTools[7])
                {
                    schetscontrol.Schets.voegtoeAanLijst(huidigeTool, new Point(mea.X, mea.Y), schetscontrol.PenKleur);
                }
            };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) => {
                if (vast)
                {
                    huidigeTool.MuisDrag(schetscontrol, mea.Location);
                    //schetscontrol.Schets.voegtoeAanLijst(huidigeTool, new Point(mea.X, mea.Y), schetscontrol.PenKleur);
                    if (huidigeTool == deTools[0])
                    {
                        schetscontrol.Schets.Schetslijst[schetscontrol.Schets.Schetslijst.Count - 1].penPunten.Add(new Point(mea.X, mea.Y));
                    }
                }
            };
            schetscontrol.MouseUp += (object o, MouseEventArgs mea) => {
                if (vast)
                {
                    huidigeTool.MuisLos(schetscontrol, mea.Location);
                }
                vast = false;

                if (huidigeTool != deTools[7])
                {
                    schetscontrol.Schets.Schetslijst[schetscontrol.Schets.Schetslijst.Count - 1].Eindpunt = new Point(mea.X, mea.Y);
                }
            };
            schetscontrol.KeyPress += (object o, KeyPressEventArgs kpea) => {
                huidigeTool.Letter(schetscontrol, kpea.KeyChar);
                if (huidigeTool == deTools[6])
                {
                    schetscontrol.Schets.Schetslijst[schetscontrol.Schets.Schetslijst.Count - 1].Tekst += kpea.KeyChar;
                }
            };
            this.Controls.Add(schetscontrol);

            menuStrip         = new MenuStrip();
            menuStrip.Visible = false;
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu(deKleuren);
            this.maakToolButtons(deTools);
            this.maakAktieButtons(deKleuren);
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
        }
Beispiel #32
0
        public SchetsWin()
        {
            ISchetsTool[] deTools = { new PenTool()
                                      , new LijnTool()
                                      , new RechthoekTool()
                                      , new VolRechthoekTool()
                                      , new CircleTool()
                                      , new FilledCircleTool()
                                      , new TekstTool()
                                      , new GumTool() };

            //Color names linked with the RGB color values (Bob Ross Colors)
            PalletColor[] deKleuren =
            {
                new PalletColor("Titanium White",   Color.FromArgb(255, 255, 255), Properties.Resources.TitaniumWhite),
                new PalletColor("Bright Red",       Color.FromArgb(219,   0,   0), Properties.Resources.BrightRed),
                new PalletColor("Indian Yellow",    Color.FromArgb(255, 184,   0), Properties.Resources.IndianYellow),
                new PalletColor("Yellow Ochre",     Color.FromArgb(199, 155,   0), Properties.Resources.YellowOchre),
                new PalletColor("Cadmium Yellow",   Color.FromArgb(255, 236,   0), Properties.Resources.CadmiumYellow),
                new PalletColor("Phthalo Green",    Color.FromArgb(16,   46,  60), Properties.Resources.PhthaloGreen),
                new PalletColor("Phthalo Blue",     Color.FromArgb(12,    0,  64), Properties.Resources.PhthaloBlue),
                new PalletColor("Prussian Blue",    Color.FromArgb(2,    30,  68), Properties.Resources.PrussianBlue),
                new PalletColor("Midnight Black",   Color.FromArgb(0,     0,   0), Properties.Resources.MidnightBlack),
                new PalletColor("Dark Sienna",      Color.FromArgb(95,   46,  31), Properties.Resources.DarkSienna),
                new PalletColor("Van Dyke Brown",   Color.FromArgb(34,   27,  21), Properties.Resources.VanDykeBrown),
                new PalletColor("Alizarin Crimson", Color.FromArgb(78,   21,   0), Properties.Resources.AlizarinCrimson),
                new PalletColor("Sap Green",        Color.FromArgb(10,   52,  16), Properties.Resources.SapGreen)
            };


            this.ClientSize = minSize;
            huidigeTool     = deTools[0];

            schetscontrol            = new SchetsControl();
            schetscontrol.Location   = new Point(64, 10);
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
            { vast = true;
              huidigeTool.MuisVast(schetscontrol, mea.Location); };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
            { if (vast)
              {
                  huidigeTool.MuisDrag(schetscontrol, mea.Location);
              }
            };
            schetscontrol.MouseUp += (object o, MouseEventArgs mea) =>
            { if (vast)
              {
                  huidigeTool.MuisLos(schetscontrol, mea.Location);
              }
              vast = false;
              Controls.Find("UndoButton", true).FirstOrDefault().Enabled = true;
              changed = true; };
            schetscontrol.KeyPress += (object o, KeyPressEventArgs kpea) =>
            { huidigeTool.Letter(schetscontrol, kpea.KeyChar);
              this.Shake(kpea, this);
              changed = true; };
            this.KeyPress += (object o, KeyPressEventArgs kpea) => {
                this.Shake(kpea, this);
            };
            this.Controls.Add(schetscontrol);

            this.Closing += Window_Closing;

            menuStrip         = new MenuStrip();
            menuStrip.Visible = false;
            sfxPlayer         = new SoundPlayer();
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu();
            this.maakToolButtons(deTools);
            this.maakAktieButtons(deKleuren);
            this.makeRightPanel();
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
        }
Beispiel #33
0
        public SchetsWin()
        {
            ISchetsTool[] deTools = { new PenTool()
                                    , new LijnTool()
                                    , new RechthoekTool()
                                    , new VolRechthoekTool()
                                    , new TekstTool()
                                    , new GumTool()
                                    , new OvaalTool()
                                    , new VolOvaalTool()
                                    };
            String[] deKleuren = { "Black", "Red", "Green", "Blue"
                                 , "Yellow", "Magenta", "Cyan"
                                 };

            String text = "";

            this.ClientSize = new Size(700, 550);
            huidigeTool = deTools[0];

            schetscontrol = new SchetsControl();
            schetscontrol.Location = new Point(64, 10);
            schetscontrol.MouseDown += (object o, MouseEventArgs mea) =>
                                       {   vast=true;
                                           huidigeTool.MuisVast(schetscontrol, mea.Location);
                                           beginLocation = mea.Location;
                                       };
            schetscontrol.MouseMove += (object o, MouseEventArgs mea) =>
                                       {   if (vast)
                                           huidigeTool.MuisDrag(schetscontrol, mea.Location);
                                       };
            schetscontrol.MouseUp   += (object o, MouseEventArgs mea) =>
                                       {
                                           if (vast)
                                           {
                                               if (huidigeTool.GetType() != typeof(TekstTool))
                                               {
                                                   schetscontrol.LayerList.Add(Tuple.Create(
                                                       huidigeTool,
                                                       schetscontrol.PenKleur,
                                                       beginLocation,
                                                       mea.Location,
                                                       text,
                                                       new List<Point>(schetscontrol.Scribble)));
                                               }
                                               huidigeTool.MuisLos(schetscontrol, mea.Location);
                                               schetscontrol.Scribble.Clear();
                                               vast = false;
                                           }
                                       };
            schetscontrol.KeyPress +=  (object o, KeyPressEventArgs kpea) =>
                                       {
                                           if (huidigeTool.GetType() == typeof(TekstTool))
                                           {
                                               if (kpea.KeyChar == (char)13) //Enter
                                               {
                                                   schetscontrol.LayerList.Add(Tuple.Create(huidigeTool,
                                                       schetscontrol.PenKleur,
                                                       beginLocation,
                                                       new Point(0, 0),
                                                       text,
                                                       new List<Point>()));
                                                   text = "";
                                               }
                                               else
                                               {
                                                   text += kpea.KeyChar;
                                               }
                                           }
                                           huidigeTool.Letter(schetscontrol, kpea.KeyChar);
                                       };
            this.Controls.Add(schetscontrol);

            menuStrip = new MenuStrip();
            menuStrip.Visible = false;
            this.Controls.Add(menuStrip);
            this.maakFileMenu();
            this.maakToolMenu(deTools);
            this.maakAktieMenu(deKleuren);
            this.maakToolButtons(deTools);
            this.maakAktieButtons(deKleuren);
            this.Resize += this.veranderAfmeting;
            this.veranderAfmeting(null, null);
        }