private void ClearScreen_Click(object sender, EventArgs e) { Shape sTemp = new ClearS(new SolidBrush(clear.Color)); Graphics gTemp = Graphics.FromImage(frameMain); clearShape.Points(0, 0, panel2.Size.Width, panel2.Size.Height); gTemp = clearShape.DrawS(gTemp); if (pointsTemp.Count > 1 && multyPoint.Contains(curentShape.GetType())) { curentShape.Points(pointsTemp.ToArray()); if (record) { RecordDrawMain.Add((Shape)Activator.CreateInstance(curentShape.GetType(), curentShape)); } else { ShapesUndo.Add((Shape)Activator.CreateInstance(curentShape.GetType(), curentShape)); } } mouseDownStarted = false; ShapesUndo.Add((Shape)Activator.CreateInstance(clearShape.GetType(), clearShape)); g.DrawImage(frameMain, 0, 0); points = new List <Point>(); pointsTemp = new List <Point>(); curentShape = (Shape)Activator.CreateInstance(curentShape.GetType(), curentShape); //curentShape.Points(pointsTemp.ToArray()); }
public Form1() { InitializeComponent(); this.AllowDrop = true; clear = new SolidBrush(colorDialog3.Color); frameMain = new Bitmap(panel2.Size.Width, panel2.Size.Height); Graphics gTemp = Graphics.FromImage(frameMain); gTemp.Clear(clear.Color); color_border.BackColor = colorDialog1.Color; color_fill.BackColor = colorDialog2.Color; BackGround.BackColor = colorDialog3.Color; g = panel2.CreateGraphics(); clearShape = new ClearS(clear); curentShape = prevShape = new FreeDrawS(new Pen(colorDialog1.Color, (float)numericUpDown1.Value)); }
private void BackGround_Click(object sender, EventArgs e) { colorDialog3.ShowDialog(); BackGround.BackColor = colorDialog3.Color; clear.Color = colorDialog3.Color; clearShape = new ClearS(clear); frameMain = new Bitmap(panel2.Size.Width, panel2.Size.Height); Graphics gTemp = Graphics.FromImage(frameMain); gTemp.Clear(clear.Color); if (ShapesUndo.Count > 0) { Shape temp = ShapesUndo.Last(); foreach (Shape T in ShapesUndo) { gTemp = T.DrawS(gTemp); } } g.DrawImage(frameMain, 0, 0); }
public ClearS(ClearS r) { brush = r.brush; }