コード例 #1
0
ファイル: Shape.cs プロジェクト: jpmofo/exp-site
 public Shape(Shape s)
 {
     myX = s.myX;
     myY = s.myY;
     myWidth = s.myWidth;
     myHeight = s.myHeight;
     myColor = s.myColor;
     myCenter = s.myCenter;
 }
コード例 #2
0
ファイル: MoveCmd.cs プロジェクト: jpmofo/exp-site
        public override void executePress(Point p, Drawing d)
        {
            lastX = p.X;
            lastY = p.Y;
            do
            {
                s = d.getFrontmostContainer(p);
                doTwice++;
            }while(doTwice < 2);

            //System.Windows.Forms.MessageBox.Show(d.getFrontmostContainer(p).ToString());
        }
コード例 #3
0
ファイル: Drawing.cs プロジェクト: jpmofo/exp-site
        //copy constructor
        public Drawing(Drawing d)
        {
            InitializeComponent();
            ClientSize = d.ClientSize;
            myImage = d.myImage;
            myShapes = new ArrayList();

            //copy each shape in list
            foreach (Shape s in d.myShapes)
            {
                myShape = new Rect(0,0,1,1,Color.Black);
                //is s a rectangle...?
                if (myShape.GetType() == s.GetType()) myShape = new Rect((Rect)s);
                else
                {
                    //is it an oval...?
                    myShape = new Oval(0,0,1,1,Color.Black);
                    if (myShape.GetType() == s.GetType()) myShape = new Oval((Oval)s);
                    else
                    {
                        //is it a line...?
                        myShape = new Segment(0,0,1,1,Color.Black,1);
                        if (myShape.GetType() == s.GetType()) myShape = new Segment((Segment)s);
                        else
                        {
                            //is it a triangle...?
                            Point p1 = new Point();
                            Point p2 = new Point();
                            Point p3 = new Point();
                            myShape = new Triangle(p1,p2,p3,Color.Black);
                            if (myShape.GetType() == s.GetType()) myShape = new Triangle((Triangle)s);
                        }
                    }
                }

                myShape.MyColor = s.MyColor;
                myShape.MyCenter = s.MyCenter;
                myShapes.Add(myShape);
            }

            myShape = d.myShape;
            offGraphics = d.offGraphics;
            visGraphics = d.visGraphics;
            offBitmap = d.offBitmap;

            offGraphics = Graphics.FromImage(offBitmap);

            myColor = d.myColor;
        }
コード例 #4
0
ファイル: Drawing.cs プロジェクト: jpmofo/exp-site
 public void front(Shape s)
 {
     Shape temp = s;
     myShapes.Remove(s);
     myShapes.Add(s);
 }
コード例 #5
0
ファイル: Drawing.cs プロジェクト: jpmofo/exp-site
 public void exchangeWithFront(Shape s)
 {
     Shape temp = (Shape) myShapes[myShapes.Count-1];
     myShapes.Insert(myShapes.IndexOf(s),temp);
     temp = s;
     myShapes.Remove(s);
     myShapes.Add(s);
 }
コード例 #6
0
ファイル: Drawing.cs プロジェクト: jpmofo/exp-site
 public void delete(Shape s)
 {
     myShapes.Remove(s);
 }
コード例 #7
0
ファイル: Drawing.cs プロジェクト: jpmofo/exp-site
 public void copy(Shape s)
 {
     Shape temp;
     if (s!=null)
     {
         temp = new Rect(0,0,1,1,Color.Black);
         //is s a rectangle...?
         if (temp.GetType() == s.GetType()) temp = new Rect((Rect)s);
         else
         {
             //is it an oval...?
             temp = new Oval(0,0,1,1,Color.Black);
             if (temp.GetType() == s.GetType()) temp = new Oval((Oval)s);
             else
             {
                 //is it a line...?
                 temp = new Segment(0,0,1,1,Color.Black,1);
                 if (temp.GetType() == s.GetType()) temp = new Segment((Segment)s);
                 else
                 {
                     //is it a triangle...?
                     Point p1 = new Point();
                     Point p2 = new Point();
                     Point p3 = new Point();
                     temp = new Triangle(p1,p2,p3,Color.Black);
                     if (temp.GetType() == s.GetType()) temp = new Triangle((Triangle)s);
                 }
             }
         }
         //put the brand new copy into myShapes right after(above in the picture) the original
         myShapes.Insert(myShapes.IndexOf(s)+1,temp);
     }
     //if s is null, do nothing
     return;
 }
コード例 #8
0
ファイル: Drawing.cs プロジェクト: jpmofo/exp-site
 //clear EVERYTHING
 public void clearAll()
 {
     if (myImage != null) myImage = null;
         myShapes.Clear();
         myShape = null;
         offGraphics.Clear(Color.White);
         //this.Invalidate();
 }
コード例 #9
0
ファイル: Drawing.cs プロジェクト: jpmofo/exp-site
 public void back(Shape s)
 {
     Shape temp = s;
     myShapes.Remove(s);
     myShapes.Insert(0,s);
 }
コード例 #10
0
ファイル: Drawing.cs プロジェクト: jpmofo/exp-site
 public void addShape(Shape s)
 {
     if (s!=null)myShapes.Add(s);
     return;
 }
コード例 #11
0
ファイル: MoveCmd.cs プロジェクト: jpmofo/exp-site
 public override void executeClick(Point p, Drawing d)
 {
     s = null;
 }