public void LoadFile(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Bob Ros Simulator Format|*.brs|Image file|*.png;*.jpg;*.jpeg;*.gif;*.ico;*.bmp;*.tiff;*.wmf|PNG image|*.png|JPG/JPEG image|*.jpeg|Bitmap image|*.BMP|Jif image|*.gif|Tiff image|*.tiff|Icon File|*.ico"; if (dialog.ShowDialog() == DialogResult.OK) { if (Path.GetExtension(dialog.FileName).ToLower() == ".brs") { string[] text = File.ReadAllLines(dialog.FileName); schetscontrol.SetDrawnShapes(DecodeBRSText(text)); schetscontrol.drawShapes(); } else { //Read image file to buffer schetscontrol.Schoon(this, null); schetscontrol.Schets.bitmap = (Bitmap)Image.FromFile(dialog.FileName); //Padding for controls (+70) Size sz = new Size(schetscontrol.Schets.bitmap.Width + 70 + rightPanel.Size.Width, schetscontrol.Schets.bitmap.Height + 50); if (sz.Width < minSize.Width) { sz.Width = minSize.Width; } if (sz.Height < minSize.Height) { sz.Height = minSize.Height; } this.veranderAfmeting(sz); schetscontrol.Invalidate(); } changed = false; } }
private void undo(object obj, EventArgs ea) { SchetsHistorie h = schetscontrol.Schets.Historie; if (!(h.Peek() is PlaatjeObject) && h.Peek() != null) { h.Undo(); schetscontrol.Invalidate(); } }
public override void Letter(SchetsControl s, char c) { if (c >= 32) { ((TextObject)mDrawingObject).Text += c; s.Invalidate(); } else if (c == '\b' && ((TextObject)mDrawingObject).Text.Length > 0) { ((TextObject)mDrawingObject).Text = ((TextObject)mDrawingObject).Text.Substring(0, ((TextObject)mDrawingObject).Text.Length - 1); s.Invalidate(); } }
public override void Letter(SchetsControl s, char c) { if (c >= 32) { // Als er een geldig tekstShape object boven aan de vormen lijst staat, bewerk dan de tekst. if (s.Schets.Vormen.Last() is TekstShape tekstShape) { tekstShape.Tekst += c; s.Invalidate(); } // tekst += c; //// // 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(); } }
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(); }
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; } }
public override void MuisDrag(SchetsControl s, Point p) { muismoved = true; s.GetSchets().AddGraphics(new Gumlijn(startpunt, p, dikte)); startpunt = p; s.Invalidate(); }
public override void MouseUp(SchetsControl s, Point p) { base.MouseUp(s, p); this.Compleet(this.startpunt, p); s.Invalidate(); mDrawingObject = null; }
public override void MuisLos(SchetsControl s, Point p) { base.MuisLos(s, p); this.Compleet(s, startpunt, p); s.Invalidate(); }
public override void MouseDrag(SchetsControl s, Point p) { if (mDrawingObject != null) { mDrawingObject.Translate(new Point(p.X - startpunt.X, p.Y - startpunt.Y)); startpunt = p; s.Invalidate(); } }
public override void Compleet(SchetsControl s, Point p1, Point p2) { if (!muismoved) { s.GetSchets().RemoveObject(p1); s.Invalidate(); } muismoved = false; }
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(); }
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); }
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 override void MouseUp(SchetsControl s, Point p) { var obj = s.Schets.FindObjectByPoint(p); if (obj != null) { s.Schets.MoveObjectDown(obj); } s.Invalidate(); }
public override void MouseUp(SchetsControl s, Point p) { base.MouseUp(s, p); var obj = s.Schets.FindObjectByPoint(p); if (obj != null) { s.Schets.RemoveObject(obj); } s.Invalidate(); }
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(); }
// Methode voor de gum in tools om te kijken of op punt muis een object is geraakt public void VerwijderObject(Point p, SchetsControl s) { for (int i = 0; i < Vormen.Count; i++) { if (IsGeraakt(Vormen[i], p)) { Vormen.RemoveAt(i); // Opnieuw lijst tekenen s.Invalidate(); } } }
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.figures = leesVanTxt(dialoog.FileName); schetscontrol.Invalidate(); } }
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(); }
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 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(); }
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(); } }
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(); } }
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(); } }
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(); } }
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(); } }
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 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(); }
public override void MuisLos(SchetsControl s, Point p, String huidigeTool) { base.MuisLos(s, p, huidigeTool); if (huidigeTool != "gum") { s.maakNieuwElement(s.PenKleur, this.startpunt, p, (char)0, huidigeTool); } else { s.verwijderElement(this.startpunt); } Console.WriteLine("Count is: " + s.elementen.Count); s.tekenOpGr(); s.Invalidate(); }
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)); } }
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(); } }
public void Delete(SchetsControl s, Point p, Graphics g) { for (int i = s.figures.Count - 1; i >= 0; i--) //delete the clicked on figure //-1 because Count will give you the third object as 3 but its index is 2 { if (raakt(s.figures[i], p)) //if startpunt is inside the s.figure[i] 'area' we need the 'raakt' function for this { s.figures.RemoveAt(i); break; } } s.Schets.Schoon(); s.Invalidate(); //we need to delete the bitmap and redraw it completely for (int i = 0; i < s.figures.Count; i++) //draw all figures after the to be deleted has be removed { s.figures[i].DrawFigure(g); } }
public override void MuisLos(SchetsControl s, Point p) { for (int i = s.Schets.Vormen.Count - 1; i > 0; i--) // 0 is de achtergrond! { PuntVorm vorm = s.Schets.Vormen[i]; if (vorm.Geklikt(p)) { s.Schets.Vormen.Remove(vorm); if (vorm.VerzamelingNummer != 0) { var verzameling = s.Schets.Vormen.FindAll(puvorm => puvorm.VerzamelingNummer == vorm.VerzamelingNummer && puvorm.GetType() == vorm.GetType()); foreach (var gelinktevorm in verzameling) s.Schets.Vormen.Remove(gelinktevorm); } s.Invalidate(); break; } } }
public override void MuisLos(SchetsControl s, Point p) { LijnVorm lijn = new LijnVorm(kwast, startpunt, p, s.PenDikte, Verzamelingnummer); s.Schets.Vormen.Add(lijn); lijn.Teken(s.CreateGraphics()); s.Invalidate(); }
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); }
//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(); } }
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(); } }
public override void MuisVast(SchetsControl s, Point p) { if(edittingLayer != null) { ((LayerText) edittingLayer).Editting = false; s.CommitAction(new SchetsActionAddLayer(edittingLayer)); s.Invalidate(); } base.MuisVast(s, p); }
public override void MuisLos(SchetsControl s, Point p) { base.MuisLos(s, p); this.Compleet(s.Schets, this.startpunt, p); s.Invalidate(); }
public override void MuisLos(SchetsControl s, Point p) { RechthoekVorm vorm = new RechthoekVorm(kwast, startpunt, p, s.PenDikte); s.Schets.Vormen.Add(vorm); s.Invalidate(); }
// Commit the move action when the tool changes public virtual void ToolChange(SchetsControl s) { if(selectedLayer != null) { s.CommitAction(new SchetsActionMove(selectedLayer, selectedLayer.Location.X - oldLayerPos.X, selectedLayer.Location.Y - oldLayerPos.Y)); s.Invalidate(); selectedLayer = null; } }
public override void Letter(SchetsControl s, char c) { if (char.IsControl(c)) return; var letter = new Letter(kleur, startpunt, c); s.Schets.Toevoegen(letter); s.Invalidate(); startpunt.X += letter.box.Width; }
public virtual void MuisDrag(SchetsControl s, Point p) { if(selectedLayer != null) { selectedLayer.Move(p.X - lastPoint.X, p.Y - lastPoint.Y); lastPoint = p; s.Invalidate(); } }
/// <summary>Erases the layer at the given position (if there is one)</summary> /// <param name="s">The SchetsControl to erase the layer from</param> /// <param name="p">The position of the layer that should be erased</param> private void eraseLayer(SchetsControl s, Point p) { // Loop through the layers from top to bottom for(int i = s.Schets.Layers.Count; i != 0; --i) { // Check if we found a layer at the given position if(s.Schets.Layers[i-1].IsClicked(p)) { s.CommitAction(new SchetsActionRemoveLayer(s.Schets.Layers[i - 1], i - 1)); s.Schets.Layers.RemoveAt(i - 1); s.Invalidate(); return; } } }
public override void MuisLos(SchetsControl s, Point p) { s.Schets.Vernieuw(); s.Invalidate(); }
public override void MuisVast(SchetsControl s, Point p) { for (int i = s.Schets.Vormen.Count - 1; i > 0; i--) // foreach werkt hier niet omdat we de dan de onderste krijgen die reageert: de achtergrond { PuntVorm vorm = s.Schets.Vormen[i]; if (vorm.Geklikt(p)) { vorm.Kwast = new SolidBrush(s.PenKleur); vorm.TekenPen = new Pen(s.PenKleur, vorm.Dikte); if (vorm.VerzamelingNummer != 0) { var verzameling = s.Schets.Vormen.FindAll(puvorm => puvorm.VerzamelingNummer == vorm.VerzamelingNummer && puvorm.GetType() == vorm.GetType()); foreach (var gelinktevorm in verzameling) { gelinktevorm.Kwast = new SolidBrush(s.PenKleur); gelinktevorm.TekenPen = new Pen(s.PenKleur, gelinktevorm.Dikte); } } s.Invalidate(); break; } } }
public override void MuisLos(SchetsControl s, Point p) { kwast = new SolidBrush(s.PenKleur); VollipsVorm vollips = new VollipsVorm((SolidBrush)kwast, startpunt, p, s.PenDikte); s.Schets.Vormen.Add(vollips); s.Invalidate(); }
/// <summary>Called when the tool is busy drawing the layer</summary> /// <param name="s">The SchetsControl that the layer should be added to</param> /// <param name="p1">The first point/location of the layer</param> /// <param name="p2">The second point/location of the layer</param> public virtual void Bezig(SchetsControl s, Point p1, Point p2) { if(edittingLayer == null) s.Schets.Layers.Add(edittingLayer = CreateLayer(p1, p2)); else ((LayerTwoPoint) edittingLayer).SecondLocation = p2; s.Invalidate(); }
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; } }
// Make sure that if we are editting a layer, the layer is always added to the Schets // and that its Editting property is set to false when changing tools public override void ToolChange(SchetsControl s) { if(edittingLayer != null) { ((LayerText)edittingLayer).Editting = false; s.CommitAction(new SchetsActionAddLayer(edittingLayer)); s.Invalidate(); } }
public override void MuisLos(SchetsControl s, Point p) { base.MuisLos(s, p); this.Compleet(s.MaakBitmapGraphics(), this.startpunt, p); s.Invalidate(); }
public override void MuisDrag(SchetsControl s, Point p) { if(edittingLayer == null) { edittingLayer = new LayerPath(startpunt, penWidth, color); ((LayerPath) edittingLayer).Points.Add(p); s.Schets.Layers.Add(edittingLayer); } else ((LayerPath) edittingLayer).Points.Add(p); s.Invalidate(); }
public override void Letter(SchetsControl s, char c) { if (c >= 32) { // If we're editting a layer, add the character to the layer // if we're not editting a layer, we create a new text layer containing the character if(edittingLayer == null) { s.Schets.Layers.Add(edittingLayer = new LayerText(this.startpunt, color, new String(c, 1))); ((LayerText) edittingLayer).Editting = true; } else ((LayerText) edittingLayer).Text += c; s.Invalidate(); } else if(c == '\b' && edittingLayer != null && ((LayerText) edittingLayer).Text.Length > 0) { // If the user pressed backspace ((LayerText)edittingLayer).Text = ((LayerText)edittingLayer).Text.Substring(0, ((LayerText)edittingLayer).Text.Length - 1); s.Invalidate(); } }