public void Undo() { if (LastAddIdx.Count == 0) { return; } int idx = LastAddIdx.Count - 1; LastAddedItems tmpItem = new LastAddedItems(); tmpItem = LastAddIdx[idx]; LastAddIdx.RemoveAt(idx); switch (tmpItem.ShapeType) { case 0: Lines.RemoveAt(tmpItem.shapeIdx); break; case 1: rectangles.RemoveAt(tmpItem.shapeIdx); break; case 2: circles.RemoveAt(tmpItem.shapeIdx); break; case 3: StraightLines.RemoveAt(tmpItem.shapeIdx); break; case 11: Images.RemoveAt(tmpItem.shapeIdx); break; case 12: TextStr.RemoveAt(tmpItem.shapeIdx); break; } HPPnl.Refresh(); }
public void ImportImage(Image Img) { ImageDetail tmpImg = new ImageDetail(); tmpImg.myImg = new Bitmap(Img); tmpImg.X = (HPPnl.Width / 2) - (tmpImg.myImg.Width / 2); tmpImg.Y = (HPPnl.Height / 2) - (tmpImg.myImg.Height / 2); Images.Add(tmpImg); LastAddedItems tmpItem = new LastAddedItems(); tmpItem.ShapeType = 11; tmpItem.shapeIdx = Images.Count() - 1; LastAddIdx.Add(tmpItem); }
public void AddTextStr() { if (mText == null) { return; } mText.Intensity = mPenIntensity; TextStr.Add(mText); LastAddedItems tmpItem = new LastAddedItems(); tmpItem.ShapeType = 12; tmpItem.shapeIdx = TextStr.Count() - 1; LastAddIdx.Add(tmpItem); mText = null; HPPnl.Refresh(); }
public void AddImageGreyScale() { if (mImg.myImg == null) { return; } ImageDetail tmpImg = new ImageDetail(); tmpImg.myImg = new Bitmap(mImg.myImg);//Helper.MakeGrayscale(new Bitmap(mImg.myImg)); tmpImg.OriginalImg = Helper.MakeGrayscale(new Bitmap(mImg.myImg)); tmpImg.X = mImg.X; tmpImg.Y = mImg.Y; Images.Add(tmpImg); mImg.myImg = null; LastAddedItems tmpItem = new LastAddedItems(); tmpItem.ShapeType = 11; tmpItem.shapeIdx = Images.Count() - 1; LastAddIdx.Add(tmpItem); HPPnl.Refresh(); }
private void panel_MouseUp(object sender, MouseEventArgs e) { draw = false; ImgMoveClick = false; TextClick = false; if (PenEnabled) { mLine.Add(new Point(e.X, e.Y)); LineDetail tmp = new LineDetail(); tmp.PenWidth = mPenWidth;//GetSelectedSize(); tmp.Intensity = mPenIntensity; tmp.LinePt.AddRange(mLine); Lines.Add(tmp); mLine.Clear(); LastAddedItems tmpItem = new LastAddedItems(); tmpItem.ShapeType = 0; tmpItem.shapeIdx = Lines.Count() - 1; LastAddIdx.Add(tmpItem); } if (StraightLineEnabled) { stLine.EndPt = new Point(e.X, e.Y); StraightLineDetail tmp = new StraightLineDetail(); tmp.PenWidth = GetSelectedSize(); tmp.StartPt = stLine.StartPt; tmp.EndPt = stLine.EndPt; StraightLines.Add(tmp); LastAddedItems tmpItem = new LastAddedItems(); tmpItem.ShapeType = 3; tmpItem.shapeIdx = StraightLines.Count() - 1; LastAddIdx.Add(tmpItem); } if (RectEnabled) { RectangleDetail tmp = new RectangleDetail(); tmp.PenWidth = GetSelectedSize(); tmp.rect = mRect; if (FilledRectEnabled) { tmp.Filled = true; } rectangles.Add(tmp); LastAddedItems tmpItem = new LastAddedItems(); tmpItem.ShapeType = 1; tmpItem.shapeIdx = rectangles.Count() - 1; LastAddIdx.Add(tmpItem); } if (CirEnabled) { RectangleDetail tmp = new RectangleDetail(); tmp.PenWidth = GetSelectedSize(); tmp.rect = mRect; if (FilledCirEnabled) { tmp.Filled = true; } circles.Add(tmp); LastAddedItems tmpItem = new LastAddedItems(); tmpItem.ShapeType = 2; tmpItem.shapeIdx = circles.Count() - 1; LastAddIdx.Add(tmpItem); } HPPnl.Refresh(); }