示例#1
0
    // This method is required for Designer support.
    private void InitializeComponent(Size W_size)
    {
        this.components           = new System.ComponentModel.Container();
        this.tabControl1          = new System.Windows.Forms.TabControl();
        this.tabPage1             = new System.Windows.Forms.TabPage();
        this.tabPage2             = new System.Windows.Forms.TabPage();
        this.tabPage3             = new System.Windows.Forms.TabPage();
        this.tabPage4             = new System.Windows.Forms.TabPage();
        this.tab1Button           = new MyButton[4];
        this.tab2Button           = new MyButton[4];
        this.tab3Button           = new MyButton[4];
        this.tab4Button           = new MyButton[4];
        this.PictureBox1          = new System.Windows.Forms.PictureBox();
        this.PictureBox1.Size     = new Size(100, 100);
        this.PictureBox1.Location = new Point(560, 500);
        this.canvas1 = new Bitmap(PictureBox1.Width, PictureBox1.Height);
        this.text1   = Graphics.FromImage(canvas1);
        this.fnt     = new Font("MU UI Gothic", 20);
        this.text1.DrawString("Before", fnt, Brushes.Blue, 0, 0);
        PictureBox1.Image         = canvas1;
        this.PictureBox2          = new System.Windows.Forms.PictureBox();
        this.PictureBox2.Size     = new Size(100, 100);
        this.PictureBox2.Location = new Point(680, 500);
        this.canvas2 = new Bitmap(PictureBox2.Width, PictureBox2.Height);
        this.text2   = Graphics.FromImage(canvas2);
        this.text2.DrawString("After", fnt, Brushes.Red, 0, 0);
        PictureBox2.Image = canvas2;


        //江夏側の設定部分
        //Face:UIに出力する顔画像部分のPicture Box
        //picture:OpenCVSharpで顔画像の読み込みクラス
        this.Face        = new System.Windows.Forms.PictureBox();
        this.static_Face = new System.Windows.Forms.PictureBox();
        this.picture     = new opencvsharp_test();

        Face.Location        = new Point(W_size.Width - 660, 10);
        static_Face.Location = new Point(20, 10);
        Face.Image           = picture.testImage.ToBitmap();
        static_Face.Image    = picture.testImage.ToBitmap();
        Face.Size            = new System.Drawing.Size(640, 480);
        static_Face.Size     = new System.Drawing.Size(640, 480);


        int  allowance = 50;
        int  first_x   = 50;
        Size T_size    = new System.Drawing.Size(W_size.Width - 40, 180 - 20);
        Size T_size2   = new System.Drawing.Size(40, 20);
        Size B_size    = new System.Drawing.Size(60, 80);

        tabControl1.Location      = new System.Drawing.Point(20, 530);
        tabControl1.Size          = T_size;
        tabControl1.SelectedIndex = 0;
        tabControl1.TabIndex      = 0;
        tabPage1.Text             = "cheek";
        tabPage1.Size             = T_size2;
        tabPage1.TabIndex         = 0;
        tabPage2.Text             = "eye";
        tabPage2.Size             = T_size2;
        tabPage2.TabIndex         = 1;
        tabPage3.Text             = "mouse";
        tabPage3.Size             = T_size2;
        tabPage3.TabIndex         = 2;
        tabPage4.Text             = "eyeshadow";
        tabPage4.Size             = T_size2;
        tabPage4.TabIndex         = 3;

        get_TabImage Tab1Image = new get_TabImage("TabImages/cheek/", "cheek", 3);

        for (int i = 0; i < 3; i++)
        {
            tab1Button[i] = new MyButton(0, i)
            {
                Image    = Tab1Image.img[i],
                Location = new System.Drawing.Point(first_x + i * (B_size.Width + allowance), T_size.Height / 4),
                Size     = B_size,
                TabIndex = i,
                Cursor   = Cursors.Hand,
            };
            tab1Button[i].Click += new System.EventHandler(this.TabButton_Click);
        }
        get_TabImage Tab2Image = new get_TabImage("TabImages/eye/", "eye", 3);

        for (int i = 0; i < 3; i++)
        {
            tab2Button[i] = new MyButton(1, i)
            {
                Image    = Tab2Image.img[i],
                Location = new System.Drawing.Point(first_x + i * (B_size.Width + allowance), T_size.Height / 4),
                Size     = B_size,
                TabIndex = i,
                Cursor   = Cursors.Hand,
            };
            tab2Button[i].Click += new System.EventHandler(this.TabButton_Click);
        }
        get_TabImage Tab3Image = new get_TabImage("TabImages/mouse/", "mouse", 3);

        for (int i = 0; i < 3; i++)
        {
            tab3Button[i] = new MyButton(2, i)
            {
                Image    = Tab3Image.img[i],
                Location = new System.Drawing.Point(first_x + i * (B_size.Width + allowance), T_size.Height / 4),
                Size     = B_size,
                TabIndex = i,
                Cursor   = Cursors.Hand,
            };
            tab3Button[i].Click += new System.EventHandler(this.TabButton_Click);
        }
        get_TabImage Tab4Image = new get_TabImage("TabImages/eyeshadow/", "eyeshadow", 3);

        for (int i = 0; i < 3; i++)
        {
            tab4Button[i] = new MyButton(3, i)
            {
                Image    = Tab4Image.img[i],
                Location = new System.Drawing.Point(first_x + i * (B_size.Width + allowance), T_size.Height / 4),
                Size     = B_size,
                TabIndex = i,
                Cursor   = Cursors.Hand,
            };
            tab4Button[i].Click += new System.EventHandler(this.TabButton_Click);
        }
        tab1Button[3] = new MyButton(9, 3)
        {
            Text     = "Reset",
            Location = new System.Drawing.Point(T_size.Width - B_size.Width - 20, T_size.Height / 4),
            Size     = B_size,
            TabIndex = 3,
            Cursor   = Cursors.Hand,
        };
        tab1Button[3].Click += new System.EventHandler(this.TabButton_Click);
        tab2Button[3]        = new MyButton(9, 3)
        {
            Text     = "Reset",
            Location = new System.Drawing.Point(T_size.Width - B_size.Width - 20, T_size.Height / 4),
            Size     = B_size,
            TabIndex = 3,
            Cursor   = Cursors.Hand,
        };
        tab2Button[3].Click += new System.EventHandler(this.TabButton_Click);
        tab3Button[3]        = new MyButton(9, 3)
        {
            Text     = "Reset",
            Location = new System.Drawing.Point(T_size.Width - B_size.Width - 20, T_size.Height / 4),
            Size     = B_size,
            TabIndex = 3,
            Cursor   = Cursors.Hand,
        };
        tab3Button[3].Click += new System.EventHandler(this.TabButton_Click);
        tab4Button[3]        = new MyButton(9, 3)
        {
            Text     = "Reset",
            Location = new System.Drawing.Point(T_size.Width - B_size.Width - 20, T_size.Height / 4),
            Size     = B_size,
            TabIndex = 3,
            Cursor   = Cursors.Hand,
        };
        tab4Button[3].Click += new System.EventHandler(this.TabButton_Click);

        this.Text = "Form1";

        for (int i = 0; i < 4; i++)
        {
            tabPage1.Controls.Add(this.tab1Button[i]);
        }
        for (int i = 0; i < 4; i++)
        {
            tabPage2.Controls.Add(this.tab2Button[i]);
        }
        for (int i = 0; i < 4; i++)
        {
            tabPage3.Controls.Add(this.tab3Button[i]);
        }
        for (int i = 0; i < 4; i++)
        {
            tabPage4.Controls.Add(this.tab4Button[i]);
        }

        this.Controls.Add(this.tabControl1);

        this.Controls.Add(this.PictureBox1);
        this.Controls.Add(this.PictureBox2);
        this.Controls.Add(this.Face);
        this.Controls.Add(this.static_Face);

        tabControl1.Controls.Add(this.tabPage1);
        tabControl1.Controls.Add(this.tabPage2);
        tabControl1.Controls.Add(this.tabPage3);
        tabControl1.Controls.Add(this.tabPage4);
    }
示例#2
0
    // This method is required for Designer support.
    private void InitializeComponent(Size W_size)
    {
        this.components  = new System.ComponentModel.Container();
        this.tabControl1 = new System.Windows.Forms.TabControl();
        this.tabPage1    = new System.Windows.Forms.TabPage();
        this.tabPage2    = new System.Windows.Forms.TabPage();
        this.tabPage3    = new System.Windows.Forms.TabPage();
        this.tab1Button  = new MyButton[3];
        this.tab2Button  = new MyButton[3];
        this.tab3Button  = new MyButton[3];
        //    this.tab2CheckBox3 = new System.Windows.Forms.CheckBox();
        //    this.tab3RadioButton2 = new System.Windows.Forms.RadioButton();
        //    this.tab2CheckBox2 = new System.Windows.Forms.CheckBox();
        //    this.tab2CheckBox1 = new System.Windows.Forms.CheckBox();
        //    this.tab3RadioButton1 = new System.Windows.Forms.RadioButton();
        //    this.tab1Label1 = new System.Windows.Forms.Label();
        //    this.tab1Button1 = new System.Windows.Forms.Button();

        int  allowance = 50;
        int  first_x   = 50;
        Size T_size    = new System.Drawing.Size(W_size.Width - 40, W_size.Height / 2 - 40);
        Size T_size2   = new System.Drawing.Size(640, 20);
        Size B_size    = new System.Drawing.Size(60, 80);

        tabControl1.Location      = new System.Drawing.Point(20, W_size.Height / 2 + 30);
        tabControl1.Size          = T_size;
        tabControl1.SelectedIndex = 0;
        tabControl1.TabIndex      = 0;
        tabPage1.Text             = "cheek";
        tabPage1.Size             = T_size2;
        tabPage1.TabIndex         = 0;
        tabPage2.Text             = "eye";
        tabPage2.Size             = T_size2;
        tabPage2.TabIndex         = 1;
        tabPage3.Text             = "mouse";
        tabPage3.Size             = T_size2;
        tabPage3.TabIndex         = 2;

        get_TabImage Tab1Image = new get_TabImage("/home/yu-suke/Pictures/cheek/", "cheek", 3);

        for (int i = 0; i < 3; i++)
        {
            tab1Button[i] = new MyButton(0, i)
            {
                Image    = Tab1Image.img[i],
                Location = new System.Drawing.Point(first_x + i * (B_size.Width + allowance), T_size.Height / 2),
                Size     = B_size,
                TabIndex = i,
            };
            tab1Button[i].Click += new System.EventHandler(this.TabButton_Click);
        }
        get_TabImage Tab2Image = new get_TabImage("/home/yu-suke/Pictures/eye/", "eye", 3);

        for (int i = 0; i < 3; i++)
        {
            tab2Button[i] = new MyButton(1, i)
            {
                Image    = Tab2Image.img[i],
                Location = new System.Drawing.Point(first_x + i * (B_size.Width + allowance), T_size.Height / 2),
                Size     = B_size,
                TabIndex = i,
            };
            tab2Button[i].Click += new System.EventHandler(this.TabButton_Click);
        }
        get_TabImage Tab3Image = new get_TabImage("/home/yu-suke/Pictures/mouse/", "mouse", 3);

        for (int i = 0; i < 3; i++)
        {
            tab3Button[i] = new MyButton(2, i)
            {
                Image    = Tab3Image.img[i],
                Location = new System.Drawing.Point(first_x + i * (B_size.Width + allowance), T_size.Height / 2),
                Size     = B_size,
                TabIndex = i,
            };
            tab3Button[i].Click += new System.EventHandler(this.TabButton_Click);
        }

        //    tab2CheckBox3.Location = new System.Drawing.Point(32, 136);
        //    tab2CheckBox3.Text = "checkBox3";
        //    tab2CheckBox3.Size = new System.Drawing.Size(176, 32);
        //    tab2CheckBox3.TabIndex = 2;
        //    tab2CheckBox3.Visible = true;
        //    tab3RadioButton2.Location = new System.Drawing.Point(40, 72);
        //    tab3RadioButton2.Text = "radioButton2";
        //    tab3RadioButton2.Size = new System.Drawing.Size(152, 24);
        //    tab3RadioButton2.TabIndex = 1;
        //    tab3RadioButton2.Visible = true;
        //    tab2CheckBox2.Location = new System.Drawing.Point(32, 80);
        //    tab2CheckBox2.Text = "checkBox2";
        //    tab2CheckBox2.Size = new System.Drawing.Size(176, 32);
        //    tab2CheckBox2.TabIndex = 1;
        //    tab2CheckBox2.Visible = true;
        //    tab2CheckBox1.Location = new System.Drawing.Point(32, 24);
        //    tab2CheckBox1.Text = "checkBox1";
        //    tab2CheckBox1.Size = new System.Drawing.Size(176, 32);
        //    tab2CheckBox1.TabIndex = 0;
        //    tab3RadioButton1.Location = new System.Drawing.Point(40, 32);
        //    tab3RadioButton1.Text = "radioButton1";
        //    tab3RadioButton1.Size = new System.Drawing.Size(152, 24);
        //    tab3RadioButton1.TabIndex = 0;
        //    tab1Button1.Location = new System.Drawing.Point(88, 144);
        //    tab1Button1.Size = new System.Drawing.Size(80, 40);
        //    tab1Button1.TabIndex = 0;
        //    tab1Button1.Text = "button1";
        //    tab1Button.Click += new
        //      System.EventHandler(this.tab1Button_Click);
        this.Text = "Form1";

        // Adds controls to the second tab page.
        //    tabPage2.Controls.Add(this.tab2CheckBox3);
        //    tabPage2.Controls.Add(this.tab2CheckBox2);
        //    tabPage2.Controls.Add(this.tab2CheckBox1);
        // Adds controls to the third tab page.
        //    tabPage3.Controls.Add(this.tab3RadioButton2);
        //    tabPage3.Controls.Add(this.tab3RadioButton1);
        // Adds controls to the first tab page.
        //    tabPage1.Controls.Add(this.tab1Label1);
        //    tabPage1.Controls.Add(this.tab1Button1);
        for (int i = 0; i < 3; i++)
        {
            tabPage1.Controls.Add(this.tab1Button[i]);
        }
        for (int i = 0; i < 3; i++)
        {
            tabPage2.Controls.Add(this.tab2Button[i]);
        }
        for (int i = 0; i < 3; i++)
        {
            tabPage3.Controls.Add(this.tab3Button[i]);
        }
        // Adds the TabControl to the form.
        this.Controls.Add(this.tabControl1);
        // Adds the tab pages to the TabControl.
        tabControl1.Controls.Add(this.tabPage1);
        tabControl1.Controls.Add(this.tabPage2);
        tabControl1.Controls.Add(this.tabPage3);
    }