Ejemplo n.º 1
0
        /// <summary>
        /// Метод добавления дочернего элемента на форму и в лист
        /// </summary>
        /// <param name="n"></param>
        private void addChild(int countNewChild, bool isCorrectChild)
        {
            for (int i = 0; i < countNewChild; i++)
            {
                ChildComponent.ChildComponent child;

                //Если нужно добавить верный дочерний элемент
                if (isCorrectChild)
                {
                    child                 = new ChildComponent.ChildComponent();
                    child.Accessory       = true;
                    child.BackgroundImage = PatternImgResources.FindNewCorrectImage(typeImages, childElemlist);
                }
                else
                {
                    child                 = new ChildComponent.ChildComponent();
                    child.Accessory       = false;
                    child.BackgroundImage = PatternImgResources.GetRandomWrongImage(typeImages);
                }
                // Рандомим позицию
                child.Location = RandomNewPoint();
                Controls.Add(child);
                childElemlist.Add(child);
                LearnToMove(child);
            }
        }
Ejemplo n.º 2
0
        public HumanVerification()
        {
            SuspendLayout();
            InitializeComponent();

            //Load Help Buttons
            pictureBox1.BackgroundImage = Resources.help_web_button;
            pictureBox2.BackgroundImage = Resources.update;

            pictureBox = new PictureBox();
            pictureBox.Invalidate(true);
            pictureBox.Size = new Size(400, 180);

            //создание списка дочерних элементов и его заполение
            childElemlist = new List <ChildComponent.ChildComponent>();
            foreach (var elem in this.Controls)
            {
                if (elem is ChildComponent.ChildComponent)
                {
                    ChildComponent.ChildComponent ch = elem as ChildComponent.ChildComponent;
                    childElemlist.Add(ch);
                }
            }
            ToPosition(this.primaryComponent1);

            //Загрузка картинок в зависимости от установленного TypesOfImages
            SetImagesFromType(typeImages);

            //После загрузки - перемещение
            childElemlist.Reverse();
            foreach (var elem in childElemlist)
            {
                LearnToMove(elem);
            }

            Invalidate();
        }