Esempio n. 1
0
        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;
        }
Esempio n. 2
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);
        }
Esempio n. 3
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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
0
        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);
        }
Esempio n. 8
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);
        }
Esempio n. 9
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);
        }
Esempio n. 10
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);
        }
Esempio n. 11
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);
        }
Esempio n. 12
0
        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
                    }
                }
            };
        }
Esempio n. 13
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);
        }
Esempio n. 14
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);
        }