Пример #1
0
 public void draw(Graphics g, myobject mine)
 {
     if (mine is mytext)
         ((mytext)mine).draw(g);
     else
         if (mine is mypic)
             ((mypic)mine).draw(g);
         else
             if (mine is myoval)
                 ((myoval)mine).draw(g);
             else
                 if (mine is myrect)
                     ((myrect)mine).draw(g);
                 else
                     if (mine is myline)
                         ((myline)mine).draw(g);
                     else
                         mine.draw(g);
 }
Пример #2
0
 private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
 {
     if (cur != null)
     {
         cur.select();
         if (cur is myline)
             direction = ((myline)cur).getresize(e.X, e.Y);
         if (direction != action.None)
         {
             mode = RESIZE;
             dx = e.X;
             dy = e.Y;
             return;
         }
         cur.unselect();
     }
     if (mode == SELECT)
     {
         cur = null;
         myobject mine=null;
         for (int k = 0; k < obj.Count; k++)
         {
             mine = obj[obj.Count - 1 - k];
             if (mine is mytext)
             {
                 if (((mytext)mine).has(e.X, e.Y))
                 {
                     cur = mine;
                     break;
                 }
             }
             else
                 if (mine is mypic)
                 {
                     if (((mypic)mine).has(e.X, e.Y))
                     {
                         cur = mine;
                         break;
                     }
                 }
                 else
                     if (mine is myoval)
                     {
                         if (((myoval)mine).has(e.X, e.Y))
                         {
                             cur = mine;
                             break;
                         }
                     }
                     else
                         if (mine is myrect)
                         {
                             if (((myrect)mine).has(e.X, e.Y))
                             {
                                 cur = mine;
                                 break;
                             }
                         }
                         else
                             if (mine is myline)
                             {
                                 if (((myline)mine).has(e.X, e.Y))
                                 {
                                     cur = mine;
                                     break;
                                 }
                                 }
         }
         if (cur != null)
             cur.select();
     }
     myobject tmp = null;
     if (mode == INSERT)
     {
         switch (current)
         {
             case SELECT:
                 break;
             case LINE:
                 tmp = new myline(e.X, e.Y);
                 break;
             case RECT:
                 tmp = new myrect(e.X, e.Y);
                 break;
             case OVAL:
                 tmp = new myoval(e.X, e.Y);
                 break;
             case PIC:
                 tmp = new mypic(e.X, e.Y);
                 if (tmpimage != null)
                 {
                     (tmp as mypic).Image = tmpimage;
                     tmpimage = null;
                 }
                 break;
             case TEXT:
                 tmp = new mytext(e.X, e.Y);
                 break;
         }
         tmp.sethostinfo( pictureBox1,obj);
         obj.Add(tmp);
         cur = tmp;
     }
     propertyGrid1.SelectedObject = cur;
 }
Пример #3
0
 public void Add(myobject str)
 {
     foreach (myobject k in List)
         k.unselect();
     base.List.Add(str);
 }
Пример #4
0
 public bool Contains(myobject str)
 {
     return base.List.Contains(str);
 }
Пример #5
0
 public void Remove(myobject str)
 {
     base.List.Remove(str);
 }