Example #1
0
        public IMemorable EndDrawing(object sender, MouseEventArgs e)
        {
            path = new List <Point>();
            Color newColor;

            switch (e.Button)
            {
            case MouseButtons.Left:
                newColor = status.FrontColor;
                break;

            case MouseButtons.Right:
                newColor = status.BackColor;
                break;

            default:
                newColor = Color.Black;
                break;
            }

            MyPictureBox pb  = sender as MyPictureBox;
            Bitmap       bmp = null;

            if (pb != null)
            {
                bmp = pb.Image;
                Color colorToChange = bmp.GetPixel(e.X, e.Y);
                if (colorToChange.ToArgb() != newColor.ToArgb())
                {
                    FloodFill(e.X, e.Y, bmp, colorToChange, newColor);
                }
            }

            return(new FillMemoryItem(new Bitmap(bmp)));
        }
Example #2
0
        private void Zadanie_4_Load(object sender, EventArgs e)
        {
            G = MyPictureBox.CreateGraphics();

            HScrollBarPitch.Minimum = 1;
            HScrollBarPitch.Maximum = 369;

            HScrollBarYaw.Minimum = 1;
            HScrollBarYaw.Maximum = 369;

            HScrollBarRoll.Minimum = 1;
            HScrollBarRoll.Maximum = 369;

            HScrollBarTheta.Minimum = 1;
            HScrollBarTheta.Maximum = 369;

            x[0] = 200;
            y[0] = 100;

            x[1] = 300;
            y[1] = 300;

            x[2] = 400;
            y[2] = 100;
        }
Example #3
0
 private void tbx_sourcecode_TextChanged(object sender, EventArgs e)
 {
     txtSourceCodeModified = tbx_sourcecode.Text;
     if (txtSourceCode == txtSourceCodeModified)
     {
         of.IsModifid = false;
     }
     else
     {
         of.IsModifid = true;
     }
     if (tbx_sourcecode.Text != "")
     {
         SetTxtColor(tbx_sourcecode.Text);
         string[] s     = tbx_sourcecode.Text.Split('\n');
         int      n     = 0;
         int      index = this.tbx_sourcecode.SelectionStart;
         for (int i = 0; i < s.Length; i++)
         {
             if (s[i].StartsWith("/*") || s[i].EndsWith("*/") || s[i].StartsWith("*"))
             {
                 n = tbx_sourcecode.GetFirstCharIndexFromLine(i);
                 tbx_sourcecode.Select(n, s[i].Length);
                 tbx_sourcecode.SelectionColor = Color.SlateGray;
                 this.tbx_sourcecode.Select(index, 0);
             }
         }
     }
     MyPictureBox.Invalidate();
 }
Example #4
0
        private void Zadanie_17_Load(object sender, EventArgs e)
        {
            G = MyPictureBox.CreateGraphics();
            int minimum, maximum;

            minimum = 0;
            maximum = 369;
            HScrollBarPitch.Minimum = minimum;
            HScrollBarPitch.Maximum = maximum;
            HScrollBarYaw.Minimum   = minimum;
            HScrollBarYaw.Maximum   = maximum;
            HScrollBarRoll.Minimum  = minimum;
            HScrollBarRoll.Maximum  = maximum;

            x0    = 0;
            y0    = 0;
            z0    = 0;
            R     = 100;
            m     = 5;
            L     = 200;
            a     = 50;
            b     = 100;
            c     = 150;
            H     = 300;
            d     = 150;
            Pitch = Factor * HScrollBarPitch.Value;
            Yaw   = Factor * HScrollBarYaw.Value;
            Roll  = Factor * HScrollBarRoll.Value;
            Fill_Cone();
        }
Example #5
0
        private void InitFieldItemAction(InitFieldItemEvent data)
        {
            var i = data.X;
            var j = data.Y;

            var pictureBox = new MyPictureBox(Field.Cells[i, j]);

            pictureBox.Width  = Constants.CellSize;
            pictureBox.Height = Constants.CellSize;

            lock (_initFieldBackgroundImageLock)
            {
                pictureBox.BackgroundImage       = _defaultImage;
                pictureBox.BackgroundImageLayout = ImageLayout.Stretch;
            }

            pictureBox.Left = i * Constants.CellSize;
            pictureBox.Top  = fieldPanel.Height - ((j + 1) * Constants.CellSize);

            _field[i, j] = pictureBox;

            lock (_initFieldItemLock)
            {
                fieldPanel.Controls.Add(pictureBox);
            }
        }
        private void Zadanie_6_Load(object sender, EventArgs e)
        {
            G = MyPictureBox.CreateGraphics();

            HScrollBarPitch.Minimum = 1;
            HScrollBarPitch.Maximum = MyPictureBox.Width;

            HScrollBarYaw.Minimum = 1;
            HScrollBarYaw.Maximum = MyPictureBox.Width;

            HScrollBarRoll.Minimum = 1;
            HScrollBarRoll.Maximum = MyPictureBox.Width;

            HScrollBarTheta.Minimum = 1;
            HScrollBarTheta.Maximum = 369;

            x[0] = 200;
            y[0] = 100;

            x[1] = 300;
            y[1] = 300;

            x[2] = 400;
            y[2] = 100;

            u     = Factor * HScrollBarPitch.Value;
            v     = Factor * HScrollBarYaw.Value;
            w     = Factor * HScrollBarRoll.Value;
            Theta = Factor * HScrollBarTheta.Value;
        }
        protected void DisplayFaceRecognitionProgress()
        {
            {
                if (students.Length != 0)
                {
                    //CREATE PICTURE BOX FOR FACE TO BE RECOGNIZED
                    unknown_face_pictureBox             = new MyPictureBox();
                    unknown_face_pictureBox.Location    = new Point(10, 10);
                    unknown_face_pictureBox.Size        = new Size(120, 120);
                    unknown_face_pictureBox.BorderStyle = BorderStyle.FixedSingle;
                    unknown_face_pictureBox.Image       = face_to_recognize.ToBitmap();

                    //CREATE PICTURE BOX FOR PERPETRATORS
                    perpetrators_pictureBox             = new MyPictureBox();
                    perpetrators_pictureBox.Location    = new Point(185, 10);
                    perpetrators_pictureBox.Size        = new Size(120, 120);
                    perpetrators_pictureBox.BorderStyle = BorderStyle.FixedSingle;

                    //CREATE PROGRESS LABEL
                    progress_label           = new Label();
                    progress_label.Location  = new Point(143, 60);
                    progress_label.ForeColor = Color.Green;
                    progress_label.Text      = "0%";

                    //CREATE PANEL CONTAINER FOR THE ABOVE CONTROLS
                    Panel panel = new Panel();
                    panel.AutoSize    = true;
                    panel.Location    = new Point(x, y);
                    panel.BorderStyle = BorderStyle.FixedSingle;
                    panel.Padding     = new Padding(10);
                    panel.Controls.AddRange(new Control[] { unknown_face_pictureBox, perpetrators_pictureBox, progress_label });



                    //SINCE THIS THREAD IS STARTED OFF THE GUI THREAD THEN INVOKES MAY BE REQUIRED
                    if (face_recog_progress_panel.InvokeRequired)
                    {
                        //ADD GUI CONTROLS USING INVOKES
                        Action action = () => face_recog_progress_panel.Controls.Add(panel);
                        face_recog_progress_panel.Invoke(action);
                    }

                    //IF NO INVOKES ARE NEEDED THEN
                    else
                    {
                        //JUST ADD THE CONTROLS
                        face_recog_progress_panel.Controls.Add(panel);
                    }



                    ShowFaceRecognitionProgress();

                    y += 145;
                }
            }
        }
        private void Button_Pixel_Click(object sender, EventArgs e)
        {
            // Создаем переменную класса Graphics
            Graphics graphic = MyPictureBox.CreateGraphics();

            // Создаем кисть Черного цвета толщиной 3
            Pen myPen = new Pen(Color.Black, 3);

            // Закрашиваем BackGround PictureBox
            MyPictureBox.BackColor = Color.FromName("Cornsilk");

            // Обновляем
            MyPictureBox.Refresh();

            // Рамзеры
            MyPictureBox.Height = 402;
            MyPictureBox.Width  = 802;

            // Нарисовать контур
            graphic.DrawRectangle(myPen, 0, 0, MyPictureBox.Size.Width - 1, MyPictureBox.Size.Height - 1);

            // Координаты перекрестия
            Point x1 = new Point(MyPictureBox.Size.Width / 2, 0);
            Point x2 = new Point(MyPictureBox.Size.Width / 2, MyPictureBox.Size.Height);
            Point y1 = new Point(0, MyPictureBox.Size.Height / 2);
            Point y2 = new Point(MyPictureBox.Size.Width, MyPictureBox.Size.Height / 2);

            // Координаты края
            int cx = MyPictureBox.Size.Width;
            int cy = MyPictureBox.Size.Height / 2;

            int Ot = 20;

            // Рисуем координатную плоскость
            graphic.DrawLine(myPen, x1, x2);
            graphic.DrawLine(myPen, y1, y2);

            // массив точек по которым будем строить график
            var ArrayPoint = new PointF[MyPictureBox.Size.Width];

            // Создаем массив
            for (int i = 0; i < MyPictureBox.Size.Width; i++)
            {
                ArrayPoint[i].Y = (float)(cy * (1 - Math.Sin(((i - 1) - Math.Abs(i)) * Ot * Math.PI / (cx - 1))));
                ArrayPoint[i].X = i;
            }

            // Создаем ксить для рисования самого графика
            Pen myPen2 = new Pen(Color.DarkGreen, 3);

            // Рисуем линию по точкам , для ислоьзуем DrawLines, Который принимает кисть и массив точек
            graphic.DrawLines(myPen2, ArrayPoint);


            graphic.Dispose();
        } // Button_Pixel_Click
Example #9
0
        private void Character()
        {
            ptbCharacter = new MyPictureBox(
                "ptbCharacter", new Point((Width - 54) / 2, Height - 100),
                new Size(67, 75), PictureBoxSizeMode.Zoom
                );

            idleAnime = new CreateAnimation(ptbCharacter, 4, MyStrings.adventureIdle, 10);
            idleAnime.StartAnimationLoop();
            Controls.Add(ptbCharacter);
        }
Example #10
0
        private void Animaton()
        {
            ptbLoading = new MyPictureBox(
                "ptbLoading", new Point((Width - 100) / 2, (Height - 74) / 2),
                new Size(100, 74), PictureBoxSizeMode.Zoom
                );

            myAnime = new CreateAnimation(ptbLoading, 20, MyStrings.adventureLoading, 30);
            myAnime.StartAnimationLoop();

            Controls.Add(ptbLoading);
        }
        private MyPictureBox CreatePerpsPictureBox(Bitmap bitmap_image)
        {
            MyPictureBox perps_picturebox = new MyPictureBox();

            perps_picturebox.Location = new System.Drawing.Point(15, 13);
            perps_picturebox.Name     = "perpetrator_picture_box";
            perps_picturebox.Size     = new System.Drawing.Size(120, 120);
            perps_picturebox.TabIndex = 0;
            perps_picturebox.TabStop  = false;
            perps_picturebox.Image    = bitmap_image;
            return(perps_picturebox);
        }
Example #12
0
        void YeniTaskEkle(MyPictureBox a, int kategori)
        {
            int TasiId = 0;

            for (int x = 0; x < cbTasks.Items.Count; x++)
            {
                if ((cbTasks.Items[x] as dynamic).Text == a.Name.Replace("_", " "))
                {
                    TasiId = Convert.ToInt32((cbTasks.Items[x] as dynamic).Value);
                }
            }
            VeritabaninaBaglan();
            komut.CommandText = "UPDATE Tasks SET TaskCategoryId=" + kategori + " WHERE Id=" + TasiId;
            komut.ExecuteNonQuery();
            VeritabaniBaglantisiniKapat();
            MyRichTextBox FoundStory = panel1.Controls.Find("rTBox" + a.StoryId, true).FirstOrDefault() as MyRichTextBox;

            if (a.CategoryId == "1")
            {
                FoundStory.Cat1Count--;
            }
            if (a.CategoryId == "2")
            {
                FoundStory.Cat2Count--;
            }
            if (a.CategoryId == "3")
            {
                FoundStory.Cat3Count--;
            }
            int sayac = -1;

            for (int x = 0; x < cbStroy.Items.Count; x++)
            {
                sayac++;
                if ((cbStroy.Items[x] as dynamic).Value == a.StoryId)
                {
                    break;
                }
            }

            if (kategori == 1)
            {
                panel2.Controls.Add(a); TaskTasi(kategori, (90 * sayac), a.Name, a, FoundStory.Cat1Count); FoundStory.Cat1Count++; a.CategoryId = "1";
            }
            if (kategori == 2)
            {
                panel3.Controls.Add(a); TaskTasi(kategori, (90 * sayac), a.Name, a, FoundStory.Cat2Count); FoundStory.Cat2Count++; a.CategoryId = "2";
            }
            if (kategori == 3)
            {
                panel4.Controls.Add(a); TaskTasi(kategori, (90 * sayac), a.Name, a, FoundStory.Cat3Count); FoundStory.Cat3Count++; a.CategoryId = "3";
            }
        }
Example #13
0
        private void Weapons()
        {
            ptbLogo = new MyPictureBox(
                "ptbLogo", new Point((Width - 80) / 2, ((Height - 80) / 2) - 50),
                new Size(80, 80), MyColors.ORANGE,
                PictureBoxSizeMode.Zoom, 10,
                Color.Transparent
                );

            myAnime = new CreateAnimation(ptbLogo, 22, MyStrings.weaponsPath, 1);
            myAnime.StartAnimationLoop();
            Controls.Add(ptbLogo);
        }
Example #14
0
        private void Zadanie_18_Load(object sender, EventArgs e)
        {
            G = MyPictureBox.CreateGraphics();
            int Minimum, Maximum;

            Minimum = 0;
            Maximum = 369;
            HScrollBarPitch.Minimum = Minimum;
            HScrollBarPitch.Maximum = Maximum;
            HScrollBarYaw.Minimum   = Minimum;
            HScrollBarYaw.Maximum   = Maximum;
            HScrollBarRoll.Minimum  = Minimum;
            HScrollBarRoll.Maximum  = Maximum;
            FillClippedCone();
        }
 private void _13_Load(object sender, EventArgs e)
 {
     {
         G = MyPictureBox.CreateGraphics();
         int Minimum, Maximum;
         Minimum = 0;
         Maximum = 369;
         HScrollBarPitch.Minimum = Minimum;
         HScrollBarPitch.Maximum = Maximum;
         HScrollBarYaw.Minimum   = Minimum;
         HScrollBarYaw.Maximum   = Maximum;
         HScrollBarRoll.Minimum  = Minimum;
         HScrollBarRoll.Maximum  = Maximum;
     }
 }
Example #16
0
        public void Success(MyLabel lblAttacks, MyPictureBox ptbCharacter)
        {
            Attacks++;
            lblAttacks.Text   = $"Attacks: {Attacks}";
            ptbCharacter.Size = new Size(125, 92);

            GamePanel.Instance().idleAnime.StopAnimation();
            GamePanel.Instance().myAnime = new CreateAnimation(ptbCharacter, 13, MyStrings.adventureAttack, 15);
            GamePanel.Instance().myAnime.StartAnimation();

            if (Attacks == GetHalfCards())
            {
                SetHighScore();
                Popup("Você completou, deseja reiniciar?", "Parabéns");
            }
        }
        private void Button_Inch_Click(object sender, EventArgs e)
        {
            Graphics graphic = MyPictureBox.CreateGraphics();
            Pen      myPen   = new Pen(Color.Black, 0.05f);

            MyPictureBox.BackColor = Color.FromName("Cornsilk");
            MyPictureBox.Refresh();
            graphic.PageUnit = GraphicsUnit.Inch;

            graphic.DrawRectangle(myPen, 0, 0, 8, 3.9f);
            MyPictureBox.Height = 380;
            MyPictureBox.Width  = 800;

            Point x1 = new Point(8 / 2, 0);
            Point x2 = new Point(8 / 2, 4);
            Point y1 = new Point(0, 4 / 2);
            Point y2 = new Point(8, 4 / 2);

            graphic.DrawLine(myPen, x1, x2);
            graphic.DrawLine(myPen, y1, y2);

            int cx = 8;
            int cy = 4 / 2;

            int Ot = 20;

            var ArrayPoint = new PointF[MyPictureBox.Size.Width];

            for (int i = 0; i < MyPictureBox.Size.Width; i++)
            {
                ArrayPoint[i].Y = (float)(cy * (1 - Math.Sin(((i - 1) - Math.Abs(i)) * Ot * Math.PI / (cx - 1))));
                ArrayPoint[i].X = i;
            }

            Pen myPen2 = new Pen(Color.Green, 0.05F);

            graphic.DrawLines(myPen2, ArrayPoint);

            /*Используйте этот метод, чтобы закрыть или освободить неуправляемые
             *    ресурсы, такие как файлы, потоки и дескрипторы, содержащиеся в
             *    экземпляре класса, который реализует этот интерфейс.*/
            graphic.Dispose();
        }
Example #18
0
        void TaskTasi(int taskcategoryid, int satirY, string name, MyPictureBox a, int objesay)
        {
            int yerlestirY = 0;
            int yerlestirX = 0;
            int bolum      = 0;

            bolum      = objesay / 2;
            yerlestirY = (35 * bolum) + ((bolum + 1) * 5);
            bolum      = 0;
            if (objesay % 2 == 1)
            {
                yerlestirX = ((bolum + 1) * 51) + ((bolum + 1) * 10);
            }
            else
            {
                yerlestirX = 5;
            }
            yerlestirY += satirY;
            a.Location  = new Point(yerlestirX, yerlestirY);
        }
        } // Button_Clear_Click

        private void Button_Milimeter_Click(object sender, EventArgs e)
        {
            Graphics graphic = MyPictureBox.CreateGraphics();
            Pen      myPen   = new Pen(Color.Black, 1f);

            MyPictureBox.BackColor = Color.FromName("Cornsilk");
            // Получает или задает единицу измерения, используемую для координат страницы в этой графике .
            graphic.PageUnit = GraphicsUnit.Millimeter;
            MyPictureBox.Refresh();
            MyPictureBox.Height = 402;
            MyPictureBox.Width  = 802;
            graphic.DrawRectangle(myPen, 0, 0, (212 - 1), (106 - 1));


            Point x1 = new Point((212 / 2), 0);
            Point x2 = new Point((212 / 2), 106);
            Point y1 = new Point(0, (106 / 2));
            Point y2 = new Point(212, 106 / 2);
            int   cx = 212;
            int   cy = 106 / 2;

            int Ot = 20;

            graphic.DrawLine(myPen, x1, x2);
            graphic.DrawLine(myPen, y1, y2);

            var ArrayPoint = new PointF[MyPictureBox.Size.Width];

            for (int i = 0; i < MyPictureBox.Size.Width; i++)
            {
                ArrayPoint[i].Y = (float)(cy * (1 - Math.Sin(((i - 1) - Math.Abs(i)) * Ot * Math.PI / (cx - 1))));
                ArrayPoint[i].X = i;
            }

            Pen myPen2 = new Pen(Color.Green, 1F);

            graphic.DrawLines(myPen2, ArrayPoint);


            graphic.Dispose();
        }
        private void RotateAxisPointThetaForm_Load(System.Object sender, System.EventArgs e)
        {
            G = MyPictureBox.CreateGraphics();

            int Minimum, Maximum;

            Minimum = 1;
            Maximum = 369;

            HScrollBarTheta.Minimum = Minimum;
            HScrollBarTheta.Maximum = Maximum;

            HScrollBarPitch.Minimum = Minimum;
            HScrollBarPitch.Maximum = MyPictureBox.Width;

            HScrollBarYaw.Minimum = Minimum;
            HScrollBarYaw.Maximum = MyPictureBox.Width;

            HScrollBarRoll.Minimum = Minimum;
            HScrollBarRoll.Maximum = MyPictureBox.Width;

            HScrollBarXOffset.Minimum = Minimum;
            HScrollBarXOffset.Maximum = MyPictureBox.Width;

            HScrollBarYOffset.Minimum = Minimum;
            HScrollBarYOffset.Maximum = MyPictureBox.Width;

            HScrollBarZOffset.Minimum = Minimum;
            HScrollBarZOffset.Maximum = MyPictureBox.Width;

            // Задаем координаты вершин треугольника
            x[0] = 200;
            y[0] = 100;

            x[1] = 300;
            y[1] = 300;

            x[2] = 400;
            y[2] = 100;
        }
Example #21
0
        public void Missed(MyLabel lblScore, MyLabel lblHits, MyPictureBox ptbCharacter)
        {
            Score -= 300;
            Hits++;

            lblScore.Text     = $"Score: {Score}";
            lblHits.Text      = $"Hits: {Hits}";
            ptbCharacter.Size = new Size(125, 92);

            if (Score > 0)
            {
                GamePanel.Instance().idleAnime.StopAnimation();
                GamePanel.Instance().myAnime = new CreateAnimation(ptbCharacter, 3, MyStrings.adventureHit, 5);
                GamePanel.Instance().myAnime.StartAnimation();
            }
            else
            {
                GamePanel.Instance().idleAnime.StopAnimation();
                GamePanel.Instance().myAnime = new CreateAnimation(ptbCharacter, 7, MyStrings.adventureDie, 5);
                GamePanel.Instance().myAnime.StartAnimation();

                Popup("Você morreu... Deseja continuar?", "Game Over");
            }
        }
Example #22
0
 private void tbx_sourcecode_Resize(object sender, EventArgs e)
 {
     MyPictureBox.Invalidate();
 }
Example #23
0
        void TaskleriListele()
        {
            int rtBoyut    = 5;
            int satirY     = 0;
            int yerlestirY = 5;
            int sayac      = -1;

            OleDbDataAdapter odat = new OleDbDataAdapter("SELECT Id, Story FROM Stories", baglanti);
            DataSet          ds   = new DataSet();

            odat.Fill(ds);
            for (int z = 0; z < ds.Tables[0].Rows.Count; z++)
            {
                ComboboxItem item = new ComboboxItem();

                komut.CommandText = "SELECT Id, TaskName, TaskCategoryId, TaskStoryId FROM Tasks WHERE TaskStoryId=" + ds.Tables[0].Rows[z][0].ToString();
                DataTable        tablom      = new DataTable();
                OleDbDataAdapter verilericek = new OleDbDataAdapter(komut);
                verilericek.Fill(tablom);
                for (int i = 0; i < tablom.Rows.Count; i++)
                {
                    item.Text  = tablom.Rows[i][1].ToString();
                    item.Value = tablom.Rows[i][0].ToString();
                    string tsid = tablom.Rows[i][3].ToString();
                    cbTasks.Items.Add(new { Text = tablom.Rows[i][1].ToString(), Value = tablom.Rows[i][0].ToString() });
                    cbTasks.DisplayMember = "Text";
                    cbStroy.ValueMember   = "Value";
                    cbTasks.SelectedIndex = 0;
                    MyPictureBox pictureBoxx = new MyPictureBox();
                    pictureBoxx.StoryId    = tablom.Rows[i][3].ToString();
                    pictureBoxx.CategoryId = tablom.Rows[i][2].ToString();
                    pictureBoxx.Image      = TaskResimAl();
                    int bolum = 0;
                    bolum = objepanel2 / 2;
                    if (tablom.Rows[i][2].ToString() == "1")
                    {
                        if (objepanel2 % 2 == 0)
                        {
                            yerlestirY = (bolum * 35) + ((bolum + 1) * 5);
                        }
                        else
                        {
                        }
                    }

                    pictureBoxx.Location = new System.Drawing.Point(rtBoyut, yerlestirY);
                    pictureBoxx.Name     = item.Text.Replace(" ", "_");
                    //"pictureBox" + i.ToString();
                    pictureBoxx.Size     = new System.Drawing.Size(51, 35);
                    pictureBoxx.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
                    pictureBoxx.TabIndex = 3;
                    pictureBoxx.TabStop  = false;
                    pictureBoxx.Paint   += new PaintEventHandler((sender, e) =>
                    {
                        e.Graphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;
                        string text = pictureBoxx.Name.Replace("_", " ");

                        SizeF textSize        = e.Graphics.MeasureString(text, Font);
                        PointF locationToDraw = new PointF();
                        locationToDraw.X      = (pictureBoxx.Width / 2) - (textSize.Width / 2);
                        locationToDraw.Y      = (pictureBoxx.Height / 2) - (textSize.Height / 2);

                        e.Graphics.DrawString(text, Font, Brushes.Black, locationToDraw);
                    });
                    pictureBoxx.Invalidate();



                    pictureBoxx.MouseDown += new System.Windows.Forms.MouseEventHandler((sender, e) =>
                    {
                        dragsource = pictureBoxx;
                        pictureBoxx.DoDragDrop(pictureBoxx.Image, DragDropEffects.All);
                    });

                    MyRichTextBox FoundStory = panel1.Controls.Find("rTBox" + tsid, true).FirstOrDefault() as MyRichTextBox;
                    if (tablom.Rows[i][2].ToString() == "1")
                    {
                        panel2.Controls.Add(pictureBoxx);
                        pictureBoxx.Location = TaskYerlestir(1, satirY, pictureBoxx.Name);
                        objepanel2++;
                        FoundStory.Cat1Count++;
                    }
                    if (tablom.Rows[i][2].ToString() == "2")
                    {
                        panel3.Controls.Add(pictureBoxx); pictureBoxx.Location = TaskYerlestir(2, satirY, pictureBoxx.Name); objepanel3++; FoundStory.Cat2Count++;
                    }
                    if (tablom.Rows[i][2].ToString() == "3")
                    {
                        panel4.Controls.Add(pictureBoxx); pictureBoxx.Location = TaskYerlestir(3, satirY, pictureBoxx.Name); objepanel4++; FoundStory.Cat3Count++;
                    }

                    sayac = -1;
                }
                satirY    += 90;
                objepanel2 = 0;
                objepanel3 = 0;
                objepanel4 = 0;
            }
        }
Example #24
0
 private void CleanUp()
 {
     unknown_face_pictureBox = null;
 }
Example #25
0
        public bool DisplayFaceRecognitionProgress(Image <Bgr, byte> face)
        {
            if (face != null)
            {
                //IF THERE ARE PERPETRATORS TO COMPARE AGAINIST
                if (active_perpetrators.Length != 0)
                {
                    //RESIZE THE FACE TO RECOGNIZE SO ITS EQUAL TO THE FACES ALREADY IN THE TRAINING SET
                    int width  = 120;
                    int height = 120;

                    face = FramesManager.ResizeColoredImage(face, new Size(width, height));

                    //CLEAR PANEL IF ITEMS ARE TOO MANY
                    ClearPanelIfItemsAreMany();

                    //CREATE PICTURE BOX FOR FACE TO BE RECOGNIZED
                    unknown_face_pictureBox             = new MyPictureBox();
                    unknown_face_pictureBox.Location    = new Point(10, 10);
                    unknown_face_pictureBox.Size        = new Size(120, 120);
                    unknown_face_pictureBox.BorderStyle = BorderStyle.FixedSingle;
                    unknown_face_pictureBox.Image       = face.ToBitmap();

                    //CREATE PICTURE BOX FOR PERPETRATORS
                    perpetrators_pictureBox             = new MyPictureBox();
                    perpetrators_pictureBox.Location    = new Point(185, 10);
                    perpetrators_pictureBox.Size        = new Size(120, 120);
                    perpetrators_pictureBox.BorderStyle = BorderStyle.FixedSingle;

                    //CREATE PROGRESS LABEL
                    progress_label           = new Label();
                    progress_label.Location  = new Point(143, 60);
                    progress_label.ForeColor = Color.Green;
                    progress_label.Text      = "0%";

                    //CREATE PANEL CONTAINER FOR THE ABOVE CONTROLS
                    Panel panel = new Panel();
                    panel.AutoSize    = true;
                    panel.Location    = new Point(x, y);
                    panel.BorderStyle = BorderStyle.FixedSingle;
                    panel.Padding     = new Padding(10);

                    panel.Controls.AddRange(new Control[] { unknown_face_pictureBox, perpetrators_pictureBox, progress_label });

                    //SINCE THIS THREAD IS STARTED OFF THE GUI THREAD THEN INVOKES MAY BE REQUIRED
                    if (panel_live_stream.InvokeRequired)
                    {
                        //ADD GUI CONTROLS USING INVOKES
                        Action action = () => panel_live_stream.Controls.Add(panel);
                        panel_live_stream.Invoke(action);
                    }

                    //IF NO INVOKES ARE NEEDED THEN
                    else
                    {
                        //JUST ADD THE CONTROLS
                        panel_live_stream.Controls.Add(panel);
                    }

                    //CREATE A NEW PROGRESS THREAD TO SHOW FACE RECOG PROGRESS
                    ShowFaceRecognitionProgress();

                    //INCREASE THE GLOBAL Y SO NEXT PIC BOXES ARE DRAWN BELOW THIS ONE
                    y += 145;
                    return(true);
                }
            }
            return(false);
        }