コード例 #1
0
        private void BeziersBox_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            switch (newType)
            {
            case MainWindow.ImageType.Line:
                drawingList.Add(new DPLine(newPoint.StartP, newPoint.EndP, Color.Black, style, scap, ecap));
                break;

            case MainWindow.ImageType.Rectangle:
                drawingList.Add(new DPRectangle(newPoint.Rect, Color.Blue, style));
                break;

            case MainWindow.ImageType.CircleAt:
                if (starCount == 10)
                {
                    pointChange = true;
                    starCount   = 0;
                    tempPoint   = new DShapeList();
                }
                break;

            case MainWindow.ImageType.Set:
                pointChange = false;
                break;
            }
            BeziersBox.Invalidate();
        }
コード例 #2
0
 private void Clear_Click(object sender, System.EventArgs e)
 {
     beziersList           = new DShapeList();
     pointList             = new DShapeList();
     tpointCollection      = new PointCollection();
     pointCollection       = new PointCollection();
     regionCollection      = new NewRegion();
     beziersPoint          = 0;
     BezierIndex           = 0;
     pointNumber           = new Number();
     pointSum              = new Number();
     drawingList           = new DShapeList();
     pointChange           = false;
     star                  = new Point[10];
     starCount             = 0;
     tempPoint             = new DShapeList();
     newType               = MainWindow.ImageType.Empty;
     this.BeziersBox.Image = null;
     BeziersBox.Invalidate();
 }
コード例 #3
0
 private void Clear_Click(object sender, System.EventArgs e)
 {
     beziersList = new DShapeList();
     pointList = new DShapeList();
     tpointCollection = new PointCollection();
     pointCollection = new PointCollection();
     regionCollection = new NewRegion();
     beziersPoint = 0;
     BezierIndex = 0;
     pointNumber = new Number();
     pointSum = new Number();
     drawingList = new DShapeList();
     pointChange = false;
     star = new Point[10];
     starCount = 0;
     tempPoint = new DShapeList();
     newType = MainWindow.ImageType.Empty;
     this.BeziersBox.Image=null;
     BeziersBox.Invalidate();
 }
コード例 #4
0
 private void BeziersBox_MouseUp(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     switch(newType)
     {
         case MainWindow.ImageType.Line:
             drawingList.Add(new DPLine(newPoint.StartP,newPoint.EndP,Color.Black,style,scap,ecap));
             break;
         case MainWindow.ImageType.Rectangle:
             drawingList.Add(new DPRectangle(newPoint.Rect,Color.Blue,style));
             break;
         case MainWindow.ImageType.CircleAt:
             if(starCount ==10)
             {
                 pointChange = true;
                 starCount=0;
                 tempPoint = new DShapeList();
             }
             break;
         case MainWindow.ImageType.Set:
             pointChange = false;
             break;
     }
     BeziersBox.Invalidate();
 }
コード例 #5
0
 /// <summary>
 /// ����¼�
 /// </summary>		
 private void Drawing_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
 {
     if (e.Button != MouseButtons.Left)
         return;
     newPoint = new MousePoint(e.X, e.Y);
     switch(newType)
     {
         case ImageType.Path:
             mousePath = new GraphicsPath();
             mousePath.AddLine(e.X,e.Y,e.X,e.Y);
             break;
         case ImageType.Eraser:
             eraser = true;
             newPoint.EndX = e.X;
             newPoint.EndY = e.Y;
             Point p = newPoint.StartP;
             p.Offset(-2,-2);
             newRegion = new Region(new Rectangle(p, new Size(4,4)));
             break;
         case ImageType.Text:
             newForm.Show();
             break;
         case ImageType.Polygon:
             pointCollection.Add(newPoint.StartP);
             tempPoint.Add(new DPoint(new Point[1]{newPoint.StartP}, newColor,lineWidth));
             Drawing.Invalidate();
             break;
         case ImageType.Curve:
             pointCollection.Add(newPoint.StartP);
             tempPoint.Add(new DPoint(new Point[1]{newPoint.StartP}, newColor,lineWidth));
             Drawing.Invalidate();
             break;
         case ImageType.ClosedCurve:
             pointCollection.Add(newPoint.StartP);
             tempPoint.Add(new DPoint(new Point[1]{newPoint.StartP}, newColor,lineWidth));
             Drawing.Invalidate();
             break;
         case ImageType.Pick:
             if(picked == true)
             {
                 for(int k=0;k<regionArrayCollection[regionIndex].Length;k++)
                 {
                     if(regionArrayCollection[regionIndex][k].IsVisible(newPoint.StartP))
                     {
                         pointIndex = k;
                         changed = true;
                         break;
                     }
                     else
                         changed = false;
                 }
                 if(changed == true)
                     break;
             }
             int m = regionIndex;
             if(picked == true)
                 m = (regionIndex+1)%regionCollection.Count;		//ѭ����һ�ʼ
             int n = 0;
             for(;n<regionCollection.Count;n++)
             {
                 if(m >= regionCollection.Count)
                     m = 0;
                 if(regionCollection[m++].IsVisible(newPoint.StartP))
                 {
                     pointViewList = new DShapeList();
                     regionIndex = m-1;
                     tempMovePoint = new Point[pointArray[regionIndex].Length];
                     for(int j=0;j<pointArray[regionIndex].Length;j++)
                     {
                         tempMovePoint[j] = pointArray[regionIndex][j];
                     }
                     PointView(regionIndex);
                     Drawing.Invalidate();
                     picked = true;
                     if(drawImageType[regionIndex]==(int)ImageType.Path)
                     {
                         mousePath = drawingList[regionIndex].pathChange(mousePath,true);
                     }
                     changed = false;
                     break;
                 }
                 else
                 {
                     pointViewList = new DShapeList();
                     Drawing.Invalidate();
                     picked = false;
                 }
             }
             break;
     }
 }
コード例 #6
0
        private void menuOpen_Click(object sender, System.EventArgs e)
        {
            if(openFileDialog.ShowDialog() == DialogResult.OK)
            {
                fileName = openFileDialog.FileName;
                try
                {
                    FileStream newStream = (FileStream)openFileDialog.OpenFile();
                    newImage = new Bitmap(newStream);
                    drawingList = new DShapeList();
                    newType = ImageType.Empty;
                    Point p = new Point(0,0);

                    notchangeList.Add(new DImage(p,newImage));
                    eraser = true;

                    Drawing.Invalidate();
                    newStream.Close();
                    SetFormTitle();
                }
                catch(IOException err)
                {
                    MessageBox.Show(err.Message,"myPGS",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// ͼ�δ洢���ϵȡ�
        /// </summary>		
        private void menuNew_Click(object sender, System.EventArgs e)
        {
            drawingList = new DShapeList();
            drawingListUndo = new DShapeList();
            tempPoint = new DShapeList();
            pointViewList = new DShapeList();
            notchangeList = new DShapeList();
            notchangeListUndo = new DShapeList();

            newForm = new NewForm();
            newCircle = new CircleForm();

            pointCollection = new ArrayList();

            regionCollection = new NewRegion();
            regionCollectionUndo = new NewRegion();
            pointArray = new PointArrayCollection();
            pointArrayUndo = new PointArrayCollection();

            regionArrayCollection = new NewRegionArray();
            regionArrayCollectionUndo = new NewRegionArray();
            drawImageType = new Type();
            drawImageTypeUndo = new Type();
            newType = ImageType.Empty;

            picked = false;
            changed = false;
            mouseMove = false;
            eraser = false;
            regionIndex = 0;

            Drawing.Invalidate();

            fileName = "NewFile";
            SetFormTitle();
        }
コード例 #8
0
        private void menuItemClose_Click(object sender, System.EventArgs e)
        {
            if(pointCollection.Count==0)
                return;
            tempPointArray = new Point[pointCollection.Count];
            byte[] tempByte = new byte[pointCollection.Count];
            int i = 0;
            foreach(Point newP in pointCollection)
            {
                tempPointArray[i] = newP;
                if(i==0)
                    tempByte[i++] = (byte)PathPointType.Start;
                else
                    tempByte[i++] = (byte)PathPointType.Line;
            }
            pointArray.Add(tempPointArray);
            Point2Region(tempPointArray);
            regionArrayCollection.Add(tempRegion);

            regionPath = new GraphicsPath(tempPointArray, tempByte);
            regionPath.CloseFigure();
            regionCollection.Add(new Region(regionPath));
            switch(newType)
            {
                case ImageType.Polygon:
                    drawingList.Add(new DPolygon(tempPointArray, newColor,lineWidth));
                    drawImageType.Add(ImageType.Polygon);
                    break;
                case ImageType.Curve:
                    drawingList.Add(new DCurve(tempPointArray, newColor,lineWidth));
                    drawImageType.Add(ImageType.Curve);
                    break;
                case ImageType.ClosedCurve:
                    drawingList.Add(new DClosedCurve(tempPointArray, newColor,lineWidth));
                    drawImageType.Add(ImageType.ClosedCurve);
                    break;
            }
            Drawing.Invalidate();
            pointCollection.RemoveRange(0,pointCollection.Count);
            tempPoint = new DShapeList();
        }