Пример #1
0
 public void Letter(SchetsControl s, Point startPoint, SolidBrush b, char c, bool addToList = false)
 {
     if (c >= 32)
     {
         Graphics gr    = s.MaakBitmapGraphics();
         Font     font  = new Font("Open Sans", 40);
         string   tekst = c.ToString();
         SizeF    sz    =
             gr.MeasureString(tekst, font, startPoint, StringFormat.GenericTypographic);
         gr.DrawString(tekst, font, b,
                       startPoint, StringFormat.GenericTypographic);
         // gr.DrawRectangle(Pens.Black, startpunt.X, startpunt.Y, sz.Width, sz.Height);
         startpunt.X += (int)sz.Width;
         if (addToList)
         {
             s.drawnShapes.Add(new DrawnLetter(startPoint, b.Color, c));
         }
         s.Invalidate();
     }
     //Add possibility of a space
     if (c.ToString() == " ")
     {
         startpunt.X += 20;
     }
     if (c == (char)Keys.Enter)
     {
         Graphics gr   = s.MaakBitmapGraphics();
         Font     font = new Font("Open Sans", 40);
         SizeF    sz   =
             gr.MeasureString("W", font, startPoint, StringFormat.GenericTypographic);
         startpunt.Y += (int)sz.Height;
         startpunt.X  = origPoint.X;
     }
 }
Пример #2
0
 public override void MuisLos(SchetsControl s, Point p)
 {
     base.MuisLos(s, p);
     this.Compleet(s.MaakBitmapGraphics(), this.startpunt, p, kwast);
     s.TekenElementen.Add(new TekenElement(this, this.startpunt, p, kwast, (char)0));
     s.Invalidate();
 }
Пример #3
0
        //Was there a click within the collision bounds of the letter?
        public override bool OnClick(SchetsControl s, Point p)
        {
            Graphics gr   = s.MaakBitmapGraphics();
            Font     font = new Font("Comic Sans", 40);
            SizeF    sz   = gr.MeasureString(letter.ToString(), font, startPoint, StringFormat.GenericTypographic);

            return(p.X >= startPoint.X && p.X <= startPoint.X + sz.Width && p.Y >= startPoint.Y && p.Y <= startPoint.Y + sz.Height);
        }
Пример #4
0
 internal void Draw(SchetsControl s)
 {
     foreach (var element in elements)
     {
         Brush brush = new SolidBrush(color);
         element.Draw(s.MaakBitmapGraphics(), brush);
     }
 }
Пример #5
0
        public override void MuisLos(SchetsControl s, Point p)
        {
            base.MuisLos(s, p);
            element.pointB = p;
            element.Draw(s.MaakBitmapGraphics(), kwast);
            s.Invalidate();

            this.drawnItem.elements.Add(element);
            Finalize(s);
        }
Пример #6
0
 public override void MuisLos(SchetsControl s, Point p)
 {
     base.MuisLos(s, p);
     this.Compleet(s.MaakBitmapGraphics(), this.startpunt, p);
     if (lastDrawnShape != null)
     {
         schetscontrol.drawnShapes.Add(lastDrawnShape);
     }
     s.Invalidate();
 }
Пример #7
0
        public override void MuisLos(SchetsControl s, Point p)
        {
            base.MuisLos(s, p);
            this.Compleet(s.MaakBitmapGraphics(), this.startpunt, p);

            //eigen!!
            o.Eigenschap(this.GetType().Name, startpunt, kwast);
            o.Toevoeg(s);

            s.Invalidate();
        }
Пример #8
0
        public void TekenLetterOpnieuw(SchetsControl s, char c, Point startpunt, Brush kwast, int rotatie)
        {
            if (c >= 32)
            {
                Graphics g = s.MaakBitmapGraphics();

                g.Transform = RoteerOmPunt(rotatie, startpunt);
                g.DrawString(c.ToString(), new Font("Tahoma", 40), kwast, startpunt, StringFormat.GenericTypographic);
                g.ResetTransform();
            }
        }
Пример #9
0
 public override void Letter(SchetsControl s, char c)
 {
     LetterElement letter;
     if (c >= 32)
     {
         letter = new LetterElement(startpunt, kwast, c);
         s.VoegElementToe(letter);
         Graphics gr = s.MaakBitmapGraphics();
         letter.teken(gr);
         SizeF sz = letter.Grootte;
         startpunt.X += (int)sz.Width;
     }
 }
Пример #10
0
        private void veranderAfmeting(object o, EventArgs ea)
        {
            schetscontrol.Size = new Size(this.ClientSize.Width - 70
                                          , this.ClientSize.Height - 50);
            paneel.Location = new Point(64, this.ClientSize.Height - 30);
            Graphics g = schetscontrol.MaakBitmapGraphics();

            foreach (SchetsItem i in schetscontrol.Itemlijst)
            {
                i.Tekenitem(g);
            }
            schetscontrol.Invalidate();
        }
Пример #11
0
        public override void Letter(SchetsControl s, char c)
        {
            LetterElement letter;

            if (c >= 32)
            {
                letter = new LetterElement(startpunt, kwast, c);
                s.VoegElementToe(letter);
                Graphics gr = s.MaakBitmapGraphics();
                letter.teken(gr);
                SizeF sz = letter.Grootte;
                startpunt.X += (int)sz.Width;
            }
        }
Пример #12
0
 public override void Letter(SchetsControl s, char c)
 {
     if (c >= 32)
     {
         Graphics gr    = s.MaakBitmapGraphics();
         Font     font  = new Font("Tahoma", 40);
         string   tekst = c.ToString();
         SizeF    sz    =
             gr.MeasureString(tekst, font, this.startpunt, StringFormat.GenericTypographic);
         gr.DrawString(tekst, font, kwast, this.startpunt, StringFormat.GenericTypographic);
         s.TekenElementen.Add(new TekenElement(this, this.startpunt, new Point(this.startpunt.X + (int)sz.Width, this.startpunt.Y + (int)sz.Height), kwast, c));
         this.startpunt.X += (int)sz.Width;
         s.Invalidate();
     }
 }
Пример #13
0
        public override void Letter(SchetsControl s, char c)
        {
            String text = "";   //maybe I need a "wait for whole string" function, that makes a string out of all chars are pressed until the user clicks somewhere again!

            if (c >= 32)
            {
                s.figures.Add(new Figure("TekstTool", startpunt, startpunt, s.PenKleur, c.ToString()));     ////////

                Graphics gr = s.MaakBitmapGraphics();


                s.figures[s.figures.Count - 1].DrawFigure(gr);

                s.Invalidate();
            }
        }
Пример #14
0
 public override void Letter(SchetsControl s, char c)
 {
     if (c >= 32)
     {
         Graphics gr    = s.MaakBitmapGraphics();
         Font     font  = new Font("Tahoma", 40);
         string   tekst = c.ToString();
         SizeF    sz    =
             gr.MeasureString(tekst, font, this.startpunt, StringFormat.GenericTypographic);
         gr.DrawString(tekst, font, kwast,
                       this.startpunt, StringFormat.GenericTypographic);
         // gr.DrawRectangle(Pens.Black, startpunt.X, startpunt.Y, sz.Width, sz.Height);
         startpunt.X += (int)sz.Width;
         s.Invalidate();
     }
 }
Пример #15
0
 public override void Letter(SchetsControl s, char c)
 {
     if (c == ' ')
     {
         startpunt.X += 20;
     }
     else if (c >= 32)
     {
         Font   font  = new Font("Segoe UI", 40);
         string tekst = c.ToString();
         SizeF  sz    =
             s.MaakBitmapGraphics().MeasureString(tekst, font, startpunt, StringFormat.GenericTypographic);
         s.GetSchets().AddGraphics(new Tekst(kwast, startpunt, c, sz, font));
         startpunt.X += (int)sz.Width;
     }
     s.Invalidate();
 }
Пример #16
0
        private void open(object obj, EventArgs ea)
        {
            OpenFileDialog dialoog = new OpenFileDialog();

            dialoog.Filter = "Tekstfiles|*.txt|Alle files|*.*";
            dialoog.Title  = "Tekening openen...";
            if (dialoog.ShowDialog() == DialogResult.OK)
            {
                schetscontrol.Schets.Schoon();
                schetscontrol.figures = leesVanTxt(dialoog.FileName);
                for (int i = 0; i < schetscontrol.figures.Count; i++)
                {
                    schetscontrol.figures[i].DrawFigure(schetscontrol.MaakBitmapGraphics());
                }
                schetscontrol.Invalidate();
            }
        }
Пример #17
0
        public override void Letter(SchetsControl s, char c)
        {
            if (c >= 32)
            {
                Graphics gr    = s.MaakBitmapGraphics();
                Font     font  = new Font("Tahoma", 40);
                string   tekst = c.ToString();
                SizeF    sz    = gr.MeasureString(tekst, font, this.startpunt, StringFormat.GenericTypographic);

                GraphicsPath myPath = new GraphicsPath();
                myPath.AddString(c.ToString(), new FontFamily("Tahoma"), (int)FontStyle.Regular, 48, this.startpunt, StringFormat.GenericDefault);

                gr.FillPath(kwast, myPath);
                startpunt.X += (int)myPath.GetBounds().Width + 5;
                s.Invalidate();
            }
        }
Пример #18
0
        public override void Letter(SchetsControl s, char c)
        {
            if (c >= 32)
            {
                Graphics gr    = s.MaakBitmapGraphics();
                Font     font  = new Font("Tahoma", 40);
                string   tekst = c.ToString();
                SizeF    sz    = gr.MeasureString(tekst, font, startpunt, StringFormat.GenericTypographic);

                // gr.DrawString(tekst, font, kwast, startpunt, StringFormat.GenericTypographic);

                startpunt.X += (int)sz.Width;
                s.Invalidate();

                this.VoegActieToe(new TekstObject(kwast, tekst, font, startpunt));
            }
        }
Пример #19
0
 public override void Letter(SchetsControl s, char c)
 {
     if (c >= 32)
     {
         Graphics gr    = s.MaakBitmapGraphics();
         Font     font  = new Font("Tahoma", 40);
         string   tekst = c.ToString();
         SizeF    sz    =
             gr.MeasureString(tekst, font, this.startpunt, StringFormat.GenericTypographic);
         gr.DrawString(tekst, font, kwast,
                       this.startpunt, StringFormat.GenericTypographic);
         // gr.DrawRectangle(Pens.Black, startpunt.X, startpunt.Y, sz.Width, sz.Height);
         // Voegt de text van de tool to aan de lijst met items
         s.Itemlijst.Add(new TextItem(this.startpunt, s.PenKleur, c, font));
         startpunt.X += (int)sz.Width;
         s.Invalidate();
     }
 }
Пример #20
0
        public override void Letter(SchetsControl s, char c)
        {
            if (c >= 32)
            {
                Graphics gr    = s.MaakBitmapGraphics();
                Font     font  = new Font("Tahoma", 40);
                string   tekst = c.ToString();
                SizeF    sz    = new SizeF(30, 64);
                gr.DrawString(tekst, font, kwast, this.startpunt, StringFormat.GenericTypographic);
                startpunt.X += (int)sz.Width;

                var obj = new ObjectVorm();
                obj.Eigenschap(this.GetType().Name, s.PenKleur, new Point(startpunt.X, startpunt.Y), tekst);
                obj.Toevoeg(s);

                s.Invalidate();
            }
        }
Пример #21
0
        public override void Letter(SchetsControl s, char c)
        {
            if (c >= 32)
            {
                Graphics gr      = s.MaakBitmapGraphics();
                Font     font    = new Font("Tahoma", 40);
                SizeF    sz      = gr.MeasureString(c.ToString(), font, this.startpunt, StringFormat.GenericTypographic);
                Point    endpunt = new Point();
                endpunt.X = startpunt.X + (int)sz.Width;
                endpunt.Y = startpunt.Y + (int)sz.Height;

                s.figures.Add(new Figure("TekstTool", startpunt, endpunt, s.PenKleur, c.ToString()));

                s.figures[s.figures.Count - 1].DrawFigure(gr);

                s.Invalidate();
                startpunt.X += (int)sz.Width;
            }
        }
Пример #22
0
        public override void MuisLos(SchetsControl s, Point p)
        {
            int      x = s.Itemlijst.Count;
            Graphics g = s.MaakBitmapGraphics();

            for (int y = x - 1; y >= 0; y = y - 1)
            {
                if (s.Itemlijst[y].Raaktpunt(p, g))
                {
                    s.Itemlijst.Remove(s.Itemlijst[y]);
                    break;
                }
            }

            s.Schets.Schoon();
            s.Invalidate();

            foreach (SchetsItem i in s.Itemlijst)
            {
                i.Tekenitem(g);
            }
            s.Invalidate();
        }
Пример #23
0
        public override void Letter(SchetsControl s, char c, int gedraaid)
        {
            if (c >= 32)
            {
                Graphics gr    = s.MaakBitmapGraphics();
                Font     font  = new Font("Tahoma", 40);
                string   tekst = c.ToString();
                SizeF    sz    = gr.MeasureString(tekst, font, this.startpunt, StringFormat.GenericTypographic);

                GraphicsPath myPath = new GraphicsPath();
                myPath.AddString(c.ToString(), new FontFamily("Tahoma"), (int)FontStyle.Regular, 48, this.startpunt, StringFormat.GenericDefault);
                int    width = (int)myPath.GetBounds().Width + 5;
                Matrix m     = new Matrix();
                m.RotateAt(gedraaid, startpunt);
                myPath.Transform(m);

                gr.FillPath(kwast, myPath);
                if (gedraaid == 0)
                {
                    startpunt.X += width;
                }
                else if (gedraaid == 90)
                {
                    startpunt.Y += width;
                }
                else if (gedraaid == 180)
                {
                    startpunt.X -= width;
                }
                else if (gedraaid == 270)
                {
                    startpunt.Y -= width;
                }

                s.Invalidate();
            }
        }
Пример #24
0
        public override void MuisLos(SchetsControl s, Point p)
        {
            base.MuisLos(s, p);
            this.Compleet(s.MaakBitmapGraphics(), this.startpunt, p);

            //toevoegen eigenschappen figuur aan de lijst
            if (this.GetType().Name != "GumTool")
            {
                if (this.GetType().Name == "VolRechthoekTool" || this.GetType().Name == "VolCirkelTool")
                {
                    var obj = new ObjectVorm(); //nieuw object gemaakt anders wordt de andere overschreven

                    obj.Eigenschap(this.GetType().Name, s.PenKleur, Punten2Rechthoek(this.startpunt, p));
                    obj.Toevoeg(s);
                }
                else if (this.GetType().Name == "PenTool" || this.GetType().Name == "LijnTool")
                {
                    var obj = new ObjectVorm();
                    obj.Eigenschap(this.GetType().Name, s.PenKleur, this.startpunt, p, s.penDikte);
                    obj.Toevoeg(s);
                }

                else //rechthoektool en cirkeltool
                {
                    var obj = new ObjectVorm();
                    obj.Eigenschap(this.GetType().Name, s.PenKleur, Punten2Rechthoek(this.startpunt, p), s.penDikte);
                    obj.Toevoeg(s);
                }
            }
            else
            {
                GumTool g = new GumTool();
                g.Gum(p.X, p.Y, s);
            }

            s.Invalidate();
        }
Пример #25
0
        // User typed something. Add it as a new element to the DrawnItem!
        public override void Letter(SchetsControl s, char c)
        {
            if (c >= 32)
            {
                string   tekst = c.ToString();
                Graphics g     = s.MaakBitmapGraphics();
                Font     font  = new Font("Tahoma", 40);
                SizeF    sz    = g.MeasureString(tekst, font, startpunt, StringFormat.GenericTypographic);

                element = new Text()
                {
                    pointA = startpunt,
                    pointB = new Point(startpunt.X + (int)sz.Width, startpunt.Y + (int)sz.Height),
                    text   = tekst,
                    font   = font
                };

                element.Draw(g, kwast);
                this.drawnItem.elements.Add(element);

                startpunt.X += (int)sz.Width;
                s.Invalidate();
            }
        }
Пример #26
0
 public override void Letter(SchetsControl s, char c)
 {
     if (c > 32)
     {
         Graphics gr = s.MaakBitmapGraphics();
         var letter = new TekstVorm(c, kwast, startpunt);
         letter.VerzamelingNummer = verzamelingNummer;
         s.Schets.Vormen.Add(letter);
         letter.Teken(gr);   // Letter moet gemeten worden voor we weten hoever we op moeten schuiven
         startpunt.X += (int)letter.sz.Width;
         s.Invalidate();
     }
     if (c == 32) //spatie, nieuw woord
     {
         verzamelingNummer++;
         startpunt.X += 20;
     }
 }
Пример #27
0
 protected void VoerCompleetUit(Element e, SchetsControl s)
 {
     s.VoegElementToe(e);
     e.teken(s.MaakBitmapGraphics());
 }
Пример #28
0
 public override void Compleet(SchetsControl s, Point p1, Point p2)
 {
     this.Bezig(s.MaakBitmapGraphics(), p1, p2);
     s.VoegElementToe(pen);
 }
Пример #29
0
 public override void MuisDrag(SchetsControl s, Point p)
 {
     if (lijn.BeginPunt != p) {
         s.Refresh();
         lijn.EindPunt = p;
         lijn.Pen = element.Pen;
         element.AddLijn(lijn);
         lijn.Teken(s.MaakBitmapGraphics());
         lijn = new LijnElement();
         lijn.BeginPunt = p;
     }
 }
Пример #30
0
 protected void VoerCompleetUit(Element e, SchetsControl s)
 {
     s.VoegElementToe(e);
     e.teken(s.MaakBitmapGraphics());
 }
Пример #31
0
 public override void MuisLos(SchetsControl s, Point p)
 {
     base.MuisLos(s, p);
     this.Compleet(s, s.MaakBitmapGraphics(), this.startpunt, p);                         //added SchetsControl as a parameter to complete, since they need the figures-list of the schetscontrol object
     s.Invalidate();
 }
Пример #32
0
 public override void Compleet(SchetsControl s, Point p1, Point p2)
 {
     this.Bezig(s.MaakBitmapGraphics(), p1, p2);
     s.VoegElementToe(pen);
 }
Пример #33
0
 public override void MuisVast(SchetsControl s, Point p)
 {
     Delete(s, p, s.MaakBitmapGraphics());
 }
Пример #34
0
 public override void MuisLos(SchetsControl s, Point p)
 {
     if (this.startpunt != p)
     {
         s.Schets.Elementen.Add(this.Element);
         this.Compleet(s.MaakBitmapGraphics(), this.startpunt, p);
         s.Invalidate();
     }
 }
Пример #35
0
 public override void Compleet(SchetsControl s, Graphics g, Point p1, Point p2)
 {
     s.figures.Add(new Figure("PenTool", p1, p2, s.PenKleur, ""));
     s.figures[s.figures.Count - 1].DrawFigure(s.MaakBitmapGraphics());
 }
Пример #36
0
 public override void Draw(SchetsControl s)
 {
     new RechthoekTool().Draw(s.MaakBitmapGraphics(), startPoint, endPoint, width, new SolidBrush(col));
 }
Пример #37
0
 public override void MuisLos(SchetsControl s, Point p)
 {
     base.MuisLos(s, p);
     this.Compleet(s.MaakBitmapGraphics(), this.startpunt, p);
     s.Invalidate();
 }
Пример #38
0
        public override void MuisLos(SchetsControl s, Point p)
        {
            base.MuisLos(s, p);
            this.Compleet(s.MaakBitmapGraphics(), this.startpunt, p);
            s.Invalidate();

            //Voeg een eindpunt toe aan het gemaakte element
            s.acties.AddEind(p);
        }
Пример #39
0
 //Variant die geen element toevoegt
 public override void LetterVirtueel(SchetsControl s, char c)
 {
     if (c >= 32)
     {
         Graphics gr = s.MaakBitmapGraphics();
         Font font = new Font("Tahoma", 40);
         string tekst = c.ToString();
         SizeF sz =
         gr.MeasureString(tekst, font, this.startpunt, StringFormat.GenericTypographic);
         gr.DrawString(tekst, font, kwast,
                                       this.startpunt, StringFormat.GenericTypographic);
         // gr.DrawRectangle(Pens.Black, startpunt.X, startpunt.Y, sz.Width, sz.Height);
         startpunt.X += (int)sz.Width;
         s.Invalidate();
     }
 }