Beispiel #1
0
 //Функция отрисовки окружности на панели
 private void DrawingCircles(ref myStorage storage, int CountElem)
 {
     //Если ячейка хранилища не пуста, то..
     if (storage.objects[CountElem] != null)
     {
         //создаем ручку, отрисовываем окружность с указанными параметрами
         Pen pen = new Pen(storage.objects[CountElem].color, 3);
         Circle_Panel.CreateGraphics().DrawEllipse(pen, storage.objects[CountElem].x,
                                                   storage.objects[CountElem].y, storage.objects[CountElem].R * 2, storage.objects[CountElem].R * 2);
     }
 }
Beispiel #2
0
 //Функция, убирающая выделение объектов
 private void SelectionRemove(ref myStorage storage)
 {
     for (int i = 0; i < amtCells; ++i)
     {
         //Если хранилище не пусто, то происходит..
         if (!storage.Empty(i))
         {
             storage.objects[i].color = DefaultColor; //установка стандартного цвета
             if (storage.objects[i].Is_Drawn == true)
             {
                 DrawingCircles(ref storage, i); //перерисовка окружности
             }
         }
     }
 }
Beispiel #3
0
 //Функция, проверяющая попадание
 private int CheckCircle(ref myStorage storage, int Size, int x, int y)
 {
     if (storage.OccupiedCells(Size) != 0)
     {
         for (int i = 0; i < Size; ++i)
         {
             if (!storage.Empty(i)) //Если хранилище не пусто
             {
                 if (Math.Sqrt(Math.Pow((x - storage.objects[i].x), 2) + Math.Pow((y - storage.objects[i].y), 2)) <= storage.objects[i].R)
                 {
                     return(i);
                 }
             }
         }
     }
     return(-1);
 }
Beispiel #4
0
            //Функция добавления объекта в хранилище
            public void AddObj(int index, ref CCircle NewObj, ref int Count, ref int item)
            {
                myStorage NewStorage = new myStorage(Count + 1);

                for (int i = 0; i < Count; ++i)
                {
                    NewStorage.objects[i] = objects[i];
                }
                for (int i = Count; i < (Count + 1) - 1; ++i)
                {
                    NewStorage.objects[i] = null;
                }

                Count = Count + 1;
                Allocation(Count);
                for (int i = 0; i < Count; ++i)
                {
                    objects[i] = NewStorage.objects[i];
                }
                objects[index] = NewObj;

                item = index;
            }