public override void MuisVast(SchetsControl s, Point p) { //Verwijder een element s.acties.Gum(p); //Redraw vanuit de acties s.RedrawFromActions(); }
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; }
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); }
public void MuisVast(SchetsControl s, Point p) { IElement element = s.Schets.GetElement(p); if (p != null) { s.Schets.Elementen.Remove(element); s.Schets.Vernieuw(); s.Invalidate(); } }
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 override void MuisLos(SchetsControl s, Point p) { for (int i = s.LayerList.Count - 1; i >= 0; i--) { if (s.LayerList[i].Item1.Collision(s, i, p)) { s.LayerList.RemoveAt(i); s.RefreshList(); s.Invalidate(); break; } } }
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; } }
public static void SaveActies(string filename, SchetsControl sc) { List<Element> e = sc.acties.Elementen; using (StreamWriter s = new StreamWriter(filename)) { s.WriteLine(sc.Schets.Bitmap.Size.Width.ToString() + "," + sc.Schets.Bitmap.Size.Height.ToString()); for (int i = 0; i < e.Count; i++) { //Element naar string converteren s.WriteLine(e[i].ToString()); } } }
public override void MuisLos(SchetsControl s, Point p) { base.MuisLos(s, p); var buffer = s.Schets.buffer; for (var i = buffer.Count - 1; i >= 0; i--) { var geometry = buffer[i]; if (geometry.Bevat(p)) { buffer.RemoveAt(i); s.Schets.Herteken(); s.Invalidate(); break; } } }
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 override bool Collision(SchetsControl s, int i, Point p) { double dx, dy, x0, y0, x1, y1, x2, y2, k; x0 = s.LayerList[i].Item3.X; y0 = s.LayerList[i].Item3.Y; x1 = s.LayerList[i].Item4.X; y1 = s.LayerList[i].Item4.Y; x2 = p.X; y2 = p.Y; dx = x1 - x0; dy = y1 - y0; k = ((x2 - x0) * dx + (y2 - y0) * dy) / (dx * dx + dy * dy); if (k > 1) { k = 1; } else if (k < 0) { k = 0; } dx = (x0 + k * dx) - x2; dy = (y0 + k * dy) - y2; return dx * dx + dy * dy <= bound * bound * 4; }
public override void MuisDrag(SchetsControl s, Point p) { s.Refresh(); this.Bezig(s.CreateGraphics(), this.startpunt, p); }
//Variant van de startfunctie die geen element toevoegd, voor het verborgen hertekenen public void MuisVirtueel(SchetsControl s, Point p) { startpunt = p; }
//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(); } }
//Variant van de letterfunctie die geen element toevoegd, voor het hertekenen uit acties public virtual void LetterVirtueel(SchetsControl s, char c) { }
public virtual void MuisLos(SchetsControl s, Point p) { kwast = new SolidBrush(s.PenKleur); }
public virtual void MuisVast(SchetsControl s, Point p) { startpunt = p; }
public void MuisRepeat(SchetsControl s, Point p) { this.MuisVirtueel(s, p); //Vul aan element beginpunt toe bij het simuleren van het lijn-tekenen s.acties.AddBegin(p); }
public override void MuisLos(SchetsControl s, Point p) { base.MuisLos(s, p); this.Compleet(s.MaakBitmapGraphics(), this.startpunt, p); s.Invalidate(); }
public override void Letter(SchetsControl s, char c) { }
public override void MuisVast(SchetsControl s, Point p) { base.MuisVast(s, p); kwast = Brushes.Gray; }
public abstract void Letter(SchetsControl s, char c);
public abstract void MuisDrag(SchetsControl s, Point p);
public virtual void MaakLetter(SchetsControl s, Graphics g, Point p1, Point p2, Brush kwast) { }
public override void MuisDrag(SchetsControl s, Point p) { }
public override void Compleet(SchetsControl s, Point p1, Point p2) { VolCirkelShape c = new VolCirkelShape(s.PenKleur, Punten2Rechthoek(p1, p2)); s.AddShape(c); }
public override void MuisDrag(SchetsControl s, Point p) { s.Refresh(); element.pointB = p; element.Draw(s.CreateGraphics(), kwast); }
public override void MuisVast(SchetsControl s, Point p) { base.MuisVast(s, p); s.AddShape(new TekstShape(s.PenKleur, startpunt, tekst)); }
public override void Compleet(SchetsControl s, Point p1, Point p2) { RechthoekShape r = new RechthoekShape(s.PenKleur, Punten2Rechthoek(p1, p2)); s.AddShape(r); }
public virtual void MuisVast(SchetsControl s, Point p) { this.MuisVirtueel(s, p); //Maak bij het klikken een nieuw te-gummen element aan s.acties.AddElement(this, startpunt, s.PenKleur); }
//public override void Bezig(Graphics g, Point p1, Point p2) //{ // g.DrawLine(MaakPen(Brushes.White, 7), p1, p2); //} public override void MuisLos(SchetsControl s, Point p) { s.Schets.VerwijderObject(p, s); }
public override void Letter(SchetsControl s, char c) { this.LetterVirtueel(s, c); if (c != ' ') s.acties.AddChar(c); }
public override void Compleet(SchetsControl s, Point p1, Point p2) { s.AddShape(new LijnShape(s.PenKleur, p1, p2)); }
public override void MuisVast(SchetsControl s, Point p) { //Herplaats een element s.acties.Til(p); //Redraw vanuit de acties om nieuwe volgorde aan te houden s.RedrawFromActions(); }
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); }
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); }
public override void MuisLos(SchetsControl s, Point p) { }
public override void MuisDrag(SchetsControl s, Point p) { this.MuisLos(s, p); this.MuisVast(s, p); }
public override void MuisDrag(SchetsControl s, Point p) { this.MuisLos(s, p); this.MuisRepeat(s, p); }
public abstract void Compleet(SchetsControl s, Point p1, Point p2);