예제 #1
0
        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();
        }
예제 #2
0
        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);
        }
예제 #3
0
        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();
        }
예제 #4
0
        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();
        }
예제 #5
0
        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();
        }