예제 #1
0
        // Starting and stopping the AGV's moviment a
        private void btnRun_Click(object sender, System.EventArgs e)
        {
            Button b = (sender as Button);

            if (b.Text == RunLabel)
            {
                b.Text              = "&Stop";
                btnStep.Enabled     = false;
                btnReset.Enabled    = false;
                txtInterval.Enabled = false;
                cbLasers.Enabled    = false;
                cbTrajeto.Enabled   = false;
                pbRobot.Hide( );
                StartMovement( );
            }
            else
            {
                StopMovement( );
                b.Text              = RunLabel;
                btnReset.Enabled    = true;
                btnStep.Enabled     = true;
                txtInterval.Enabled = true;
                cbLasers.Enabled    = true;
                cbTrajeto.Enabled   = true;
                pbRobot.Show( );
                pbTerrain.Image = CopyImage(OriginalMap);
                pbTerrain.Refresh( );
            }
        }
예제 #2
0
파일: Level4.cs 프로젝트: sashkooooy/MyRepo
 public void BeerColision(PictureBox wal)
 {
     if (Player.Right > wal.Left && Player.Left < wal.Right - Player.Width / 2 && Player.Bottom > wal.Top && Player.Top < wal.Bottom) { wal.Hide();   }
        if (Player.Left < wal.Right && Player.Right > wal.Left + Player.Width / 2 && Player.Bottom > wal.Top && Player.Top < wal.Bottom) { wal.Hide();   }
        if (Player.Bottom + 5 >= wal.Top && Player.Top < wal.Top - Player.Height / 2 && Player.Right - 2 > wal.Left && Player.Left + 5 < wal.Right) { wal.Hide(); }
        if (Player.Top - 5 <= wal.Bottom && Player.Bottom > wal.Bottom - Player.Height / 2 && Player.Right - 2 > wal.Left && Player.Left + 5 < wal.Right) { wal.Hide();   }
 }
예제 #3
0
 private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     lbMsg.Hide();
     lbFio.Hide();
     pbPhoto.Hide();
     cbEmployees.Text = "";
     tbCode.Text      = "";
     tbCode.Focus();
     timer.Enabled  = false;
     timer.Interval = 1500;
 }
예제 #4
0
 private void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     lbMsg.Hide();
     lbFio.Hide();
     pbPhoto.Hide();
     timer.Enabled = false;
 }
예제 #5
0
        public DeckBuilder()
            : base()
        {
            AutoScroll = true;

            columns = new List<List<DeckBuilderCard>[]>();
            for (int i = 0; i < NUM_INITIAL_COLUMNS; i++)
            {
                columns.Add(new List<DeckBuilderCard>[2]);
                columns[i][0] = new List<DeckBuilderCard>();
                columns[i][1] = new List<DeckBuilderCard>();
            }

            // Make indicator.
            indicator = new PictureBox();
            indicator.BackColor = INDICATOR_COLOR;
            Controls.Add(indicator);
            indicator.Hide();
        }
예제 #6
0
        public CharacterCreation()
        {
            warriorPicBox = new PictureBox();
            warriorPicBox.Image = Properties.Resources.warrior;
            warriorPicBox.Width = 250;
            warriorPicBox.Height = 250;
            warriorPicBox.BackColor = Color.Transparent;
            warriorPicBox.Left = 190;
            warriorPicBox.Top = 240;
            this.Controls.Add(warriorPicBox);

            roguePicBox = new PictureBox();
            roguePicBox.Image = Properties.Resources.rogue;
            roguePicBox.Width = 250;
            roguePicBox.Height = 250;
            roguePicBox.BackColor = Color.Transparent;
            roguePicBox.Left = 190;
            roguePicBox.Top = 240;
            this.Controls.Add(roguePicBox);
            roguePicBox.Hide();

            magePicBox = new PictureBox();
            magePicBox.Image = Properties.Resources.mage;
            magePicBox.Width = 250;
            magePicBox.Height = 250;
            magePicBox.BackColor = Color.Transparent;
            magePicBox.Left = 190;
            magePicBox.Top = 240;
            this.Controls.Add(magePicBox);
            magePicBox.Hide();

            InitializeComponent();

            //TODO: This will be moved on checked event, but for now, lets load bars here:

            strengthProgressBar.Maximum = 50;
            dexterityProgressBar.Maximum = 50;
            vitalityProgressBar.Maximum = 50;
            intelligenceProgressBar.Maximum = 50;

            // TODO: Add background music and sound for clicks
        }
예제 #7
0
        public MpeStatusBar()
        {
            // This call is required by the Windows.Forms Form Designer.

            InitializeComponent();
            progressBar                = new ProgressBarEx();
            progressBar.Smooth         = true;
            progressBar.Anchor         = ((AnchorStyles)((AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Top)));
            progressBar.Size           = new Size(150, 16);
            progressBar.Location       = new Point(statusBar.Width - 165, 2);
            progressBar.Enable3DBorder = true;
            progressBar.Border3D       = Border3DStyle.Flat;
            progressBar.BorderColor    = Color.FromKnownColor(KnownColor.ControlDark);
            statusBar.Controls.Add(progressBar);
            currentLevel = MpeLogLevel.Debug;
            debugIcon.Hide();
            infoIcon.Hide();
            warnIcon.Hide();
            errorIcon.Hide();
            panelFontBrush     = new SolidBrush(Color.Black);
            panelBorderPen     = new Pen(Color.FromKnownColor(KnownColor.ControlDark), -1.0f);
            locationPanel.Text = "";
        }
예제 #8
0
        private void updateDialog()
        {
            if (platform is FatPlatform)
            {
                FatPlatform fp = (FatPlatform)platform;
                if (!fp.hasLane(lIdx))
                {
                    left.Text = "Left connect";
                }
                //! if(!fp.hasLane(lIdx))	left.Text = "左に接続";
                else
                {
                    left.Text = "Left release";
                }
                //! else					left.Text = "左を解放";
                if (!fp.hasLane(rIdx))
                {
                    right.Text = "Right connect";
                }
                //! if(!fp.hasLane(rIdx))	right.Text = "右に接続";
                else
                {
                    right.Text = "Right release";
                }
                //! else					right.Text = "右を解放";
            }

            if (platform.host != null)
            {
                warning.Hide();
            }
            else
            {
                warning.Show();
            }
        }
예제 #9
0
        private void avatarBox_Click(object sender, EventArgs e)
        {
            if (pb != null)
            {
                this.WindowState = FormWindowState.Maximized;
                p.Show();
                pb.Show();
            }
            else
            {
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    p = new Panel();
                    p.Location = new Point(0, 0);

                    p.BackColor = Color.Black;

                    pb = new PictureBox();
                    string url = _User.profile_image_url.Replace("_normal", "");

                    var request = WebRequestFactory.CreateHttpRequest(url);
                    var httpResponse = (HttpWebResponse)request.GetResponse();
                    Stream stream = httpResponse.GetResponseStream();

                    Image i = new Bitmap(stream);
                    pb.Image = i;
                    pb.SizeMode = PictureBoxSizeMode.StretchImage;

                    this.WindowState = FormWindowState.Maximized;

                    pb.Size = getImageSize(i.Size, Screen.PrimaryScreen.Bounds.Size);

                    pb.Location = new Point((Screen.PrimaryScreen.Bounds.Width / 2) - (pb.Size.Width / 2), (Screen.PrimaryScreen.Bounds.Height / 2) - (pb.Size.Height / 2));

                    pb.Click += new EventHandler(pb_Click);
                    p.Click += new EventHandler(pb_Click);

                    p.Size = new Size(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
                    p.Visible = true;
                    this.Controls.Add(p);
                    p.BringToFront();

                    this.Controls.Add(pb);

                    pb.BringToFront();
                    Cursor.Current = Cursors.Default;
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.WriteLine(ex.Message);
                    pb.Hide();
                }
            }
        }
예제 #10
0
 private void setOKState(PictureBox image)
 {
     image.Hide();
 }
예제 #11
0
        private void timerALienBullets_Tick(object sender, EventArgs e)
        {
            int ran = GetRandomInt(0, ALiens.Count);
            PictureBox bullet = new PictureBox();
            bullet.Image = SpaceInvad.Properties.Resources.bullet;
            bullet.SizeMode = PictureBoxSizeMode.AutoSize;
            bullet.Location = new Point(ALiens[ran].Location.X + 9, ALiens[ran].Location.Y + 10);
            bullet.Name = "alienbullet";
            this.Controls.Add(bullet);

            while (bullet.Location.Y < this.Width + 40 && bullet.Visible == true)
            {
                int count =0;
                foreach (PictureBox p in Homes)
                {
                    if (bullet.Bounds.IntersectsWith(p.Bounds))
                    {
                        if (HomeStates[count] == 0)
                        {

                            p.Image = SpaceInvad.Properties.Resources.house1;
                            HomeStates[count]++;
                            bullet.Hide();
                            Application.DoEvents();
                            break;
                        }

                        else if (HomeStates[count] == 1)
                        {
                            p.Image = SpaceInvad.Properties.Resources.house2;
                            HomeStates[count]++;
                            bullet.Hide();
                            break;
                        }

                        else if (HomeStates[count] == 2)
                        {
                            p.Hide();
                            bullet.Hide();
                            break;
                        }
                        count++;
                    }
                }

                bullet.Location = new Point(bullet.Location.X, bullet.Location.Y + 1);
                bullet.Refresh();
                foreach (PictureBox p in Players)
                {
                    if (bullet.Bounds.IntersectsWith(p.Bounds) && p.Visible == true)
                    {

                        Players[0].Image = SpaceInvad.Properties.Resources.ship2;
                        p.Refresh();
                        axWindowsMediaPlayer1.URL = Application.StartupPath + @"\explosion.wav";

                        Stopwatch sw = new Stopwatch();
                        for (int i = 0; ; i++)
                        {
                            if (i % 100000 == 0) // if in 100000th iteration (could be any other large number
                            // depending on how often you want the time to be checked)
                            {
                                sw.Stop(); // stop the time measurement
                                if (sw.ElapsedMilliseconds > 500) // check if desired period of time has elapsed
                                {
                                    break; // if more than 5000 milliseconds have passed, stop looping and return
                                    // to the existing code
                                }
                                else
                                {
                                    sw.Start(); // if less than 5000 milliseconds have elapsed, continue looping
                                    // and resume time measurement
                                }
                            }
                        }
                        bullet.Hide();
                        if (lives <= 0)
                        {
                            timerALienBullets.Enabled = false;
                            Players[0].Hide();
                            score = 0;
                            ALiens = new List<PictureBox>();
                            Homes = new List<PictureBox>();
                            Players = new List<PictureBox>();
                            this.Controls.Clear();
                            CreateAliens();
                            CreatePlayer();
                            this.Refresh();
                            timerAnimateAlien.Interval = 600;
                            HomeStates[0] = 0;
                            HomeStates[1] = 0;
                            HomeStates[2] = 0;
                            Players[0].Show();
                            Players[0].Image = SpaceInvad.Properties.Resources.ship;
                            CreateHomes();
                            timerALienBullets.Enabled = true;
                            break;
                        }

                        else
                        {
                            timerALienBullets.Enabled = false;
                            Players[0].Hide();
                            Players = new List<PictureBox>();
                            CreatePlayer();
                            this.Refresh();
                            timerAnimateAlien.Interval = 600;
                            Players[0].Show();
                            Players[0].Image = SpaceInvad.Properties.Resources.ship;
                            timerALienBullets.Enabled = true;
                            lives--;
                            CreateHUD();
                            break;
                        }

                    }

                }
            }
        }
예제 #12
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.C)
            {
                txtcheats.Show();
            }

            if (e.KeyCode == Keys.Space)
            {
                axWindowsMediaPlayer4.URL = Application.StartupPath + @"\shoot.wav";

                if (bonus == false)
                {
                    int ran = GetRandomInt(1, 10);
                    if (ran == 4)
                    {
                        axWindowsMediaPlayer3.URL = Application.StartupPath + @"\ufo_lowpitch.wav";
                        bonus = true;
                        PictureBox spaceship = new PictureBox();
                        spaceship.Image = SpaceInvad.Properties.Resources.spaceship;
                        spaceship.SizeMode = PictureBoxSizeMode.AutoSize;
                        spaceship.Location = new Point(3, 49);
                        spaceship.Name = "ss";
                        SpaceShip.Add(spaceship);
                        this.Controls.Add(SpaceShip[0]);
                        timerAnimateShipSpace.Enabled = true;
                    }
                }

                PictureBox bullet = new PictureBox();
                bullet.Image = SpaceInvad.Properties.Resources.bullet;
                bullet.SizeMode = PictureBoxSizeMode.AutoSize;
                bullet.Location = new Point(Players[0].Location.X + 9, Players[0].Location.Y - 10);
                bullet.Name = "bullet";
                this.Controls.Add(bullet);

                while (bullet.Location.Y > -30 && bullet.Visible == true)
                {
                    bullet.Location = new Point(bullet.Location.X, bullet.Location.Y - 1);
                    bullet.Refresh();

                    int count = 0;
                    foreach (PictureBox p in Homes)
                    {
                        if (bullet.Bounds.IntersectsWith(p.Bounds) && p.Visible == true)
                        {
                            if (HomeStates[count] == 0)
                            {

                                p.Image = SpaceInvad.Properties.Resources.house1;
                                HomeStates[count]++;
                                bullet.Hide();
                                Application.DoEvents();
                                break;
                            }

                            else if (HomeStates[count] == 1)
                            {
                                p.Image = SpaceInvad.Properties.Resources.house2;
                                HomeStates[count]++;
                                bullet.Hide();
                                break;
                            }

                            else if (HomeStates[count] == 2)
                            {
                                p.Hide();
                                bullet.Hide();
                                break;
                            }
                        }

                        count++;
                    }

                    foreach (PictureBox p in ALiens)
                    {

                        int ALiensvis = 0;

                        foreach (PictureBox alien in ALiens)
                        {
                            if (alien.Visible == true)
                            {
                                ALiensvis++;
                            }
                        }

                        if (ALiensvis == ALiens.Count / 2)
                        {
                            timerAnimateAlien.Interval = 300;
                        }

                        else if (ALiensvis <= 4)
                        {
                            timerAnimateAlien.Interval = 50;
                        }
                        if (bullet.Bounds.IntersectsWith(p.Bounds))
                        {
                            Application.DoEvents();
                            p.Image = SpaceInvad.Properties.Resources.aliendead;
                            p.Refresh();
                            axWindowsMediaPlayer1.URL = Application.StartupPath + @"\invaderkilled.wav";

                            Stopwatch sw = new Stopwatch(); // sw cotructor
                            sw.Start(); // starts the stopwatch
                            for (int i = 0; ; i++)
                            {

                                if (i % 100000 == 0) // if in 100000th iteration (could be any other large number
                                // depending on how often you want the time to be checked)
                                {
                                    sw.Stop(); // stop the time measurement
                                    if (sw.ElapsedMilliseconds > 100) // check if desired period of time has elapsed
                                    {
                                        break; // if more than 5000 milliseconds have passed, stop looping and return
                                        // to the existing code
                                    }
                                    else
                                    {

                                        sw.Start(); // if less than 5000 milliseconds have elapsed, continue looping
                                        // and resume time measurement
                                    }
                                }
                            }
                            bullet.Hide();
                            p.Hide();
                            //hack throw picturebox off screen in -ve axis to stop multiple hits
                            p.Location = new Point(-1000, -1000);
                            score = score + 10;
                            Application.DoEvents();
                            label1.Text = score.ToString();
                            break;
                        }
                    }
                }

            }

            if (Players[0].Location.X >= 1)
            {
                if (e.KeyCode == Keys.Left)
                {
                    Players[0].Left -= 10;
                }
            }

            if (Players[0].Location.X <= this.Width - 60)
            {

                if (e.KeyCode == Keys.Right)
                {
                    Players[0].Left += 10;
                }
            }
        }
예제 #13
0
파일: Game.cs 프로젝트: ZombieMK/Hangman
        private void startGame(int type)
        {
            OleDbConnection connection = new OleDbConnection();
            connection.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=besilka.accdb;Persist Security Info=False;";
            connection.Open();

            OleDbCommand getWords = new OleDbCommand();
            getWords.Connection = connection;
            getWords.CommandText = "SELECT * FROM Words WHERE ID_Category = " + type.ToString();

            OleDbDataReader wordsReader = getWords.ExecuteReader();

            List<string> words = new List<string>();

            while (wordsReader.Read())
            {
                string tmoWord = wordsReader[2].ToString();
                words.Add(tmoWord);
            }

            connection.Close();

            Random nrnd = new Random();
            choosenWord = words[nrnd.Next(words.Count())];

            pictures.Clear();
            picturesStart.Clear();

            for (int i = 0; i < choosenWord.Length; i++)
            {
                if (choosenWord[i] == ' ')
                {
                    PictureBox emptyPC = new PictureBox();
                    picturesStart.Add(emptyPC);
                    pictures.Add(emptyPC);
                    continue;
                }

                // Picture Start
                PictureBox tmpPicure = new PictureBox();
                tmpPicure.Size = new Size(40, 40);
                tmpPicure.Location = new Point(380 + i * 35, 400);
                tmpPicure.Image = Image.FromFile(@"Letters\_.png");
                tmpPicure.BackColor = System.Drawing.Color.Transparent;
                tmpPicure.Show();
                picturesStart.Add(tmpPicure);
                this.Controls.Add(tmpPicure);

                // Picture

                PictureBox realPicture = new PictureBox();
                realPicture.Size = new Size(40, 40);
                realPicture.Location = new Point(380 + i * 35, 400);
                realPicture.BackColor = System.Drawing.Color.Transparent;
                realPicture.Hide();
                string location = @"Letters\" + choosenWord[i] + ".png";
                realPicture.Image = Image.FromFile(location);

                pictures.Add(realPicture);
                this.Controls.Add(realPicture);
            }
        }
예제 #14
0
파일: Form1.cs 프로젝트: sdsaoo/Class
        private int create(string content)
        {
            //何×何か
            int width_max = 0, height_max = 0, start_x = 0, start_y = 0;
            bool two_flag = false, three_flag = false;
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            System.IO.StringReader rs = new System.IO.StringReader(content);
            //1行ずつ読み込む
            while(rs.Peek() > -1)
            {
                int count = 0;
                string t = rs.ReadLine();
                for(int i = 0; i < t.Length; i++)
                {
                    if (!Char.IsDigit(t[i]))
                    {
                        //0,1,2,3以外の文字が含まれていないか
                        if (!(t[i] == ' ' || t[i] == ','))
                            return 3;
                    }
                    else
                    {
                        count++;
                        if (t[i] == '2')
                            two_flag = true;
                        if (t[i] == '3')
                            three_flag = true;
                    }
                }
                //更新
                if (width_max < count)
                    width_max = count;
                if (count != 0)
                    height_max++;
                else
                {
                    //空行が含まれているか
                    if (width_max == 0)
                        return 4;
                }
            }
            //2,3を含んでいたか
            if (two_flag == false || three_flag == false)
                return 1;

            //ボタン設定
            bt6.Show();
            bt7.Show();
            bt8.Show();

            //タブコントロールを表示
            tab = new TabControl();
            tab.Size = new Size(460, 385);
            tab.Location = new Point(10,35);
            TabPage tab1 = new TabPage("木構造");
            tab.TabPages.Add(tab1);
            TabPage tab2 = new TabPage("迷路回答");
            tab.TabPages.Add(tab2);
            this.Controls.Add(tab);

            //パネルの設定
            panel1 = new Panel();
            panel1.BorderStyle = BorderStyle.Fixed3D;
            panel1.Location = new Point(5, 5);
            panel1.Size = new Size(440, 350);
            panel1.BackColor = Color.White;
            panel1.AutoScroll = true;
            tab1.Controls.Add(panel1);

            panel2 = new Panel();
            panel2.BorderStyle = BorderStyle.Fixed3D;
            panel2.Location = new Point(5, 5);
            panel2.Size = new Size(440, 350);
            panel2.BackColor = Color.White;
            panel2.AutoScroll = true;
            tab2.Controls.Add(panel2);

            //ピクチャーボックスの設定
            pb1 = new PictureBox();
            pb1.Location = new Point(0, 0);
            pb1.Size = new Size(400, 345);
            pb1.BackColor = Color.White;
            panel1.Controls.Add(pb1);

            pb2 = new PictureBox();
            pb2.Location = new Point(0, 0);
            pb2.BackColor = Color.White;
            panel2.Controls.Add(pb2);

            pb3 = new PictureBox();
            pb3.Location = new Point(0, 0);
            pb3.Size = new Size(400, 345);
            pb3.BackColor = Color.White;
            panel1.Controls.Add(pb3);
            pb3.Hide();

            pb4 = new PictureBox();
            pb4.Location = new Point(0, 0);
            pb4.BackColor = Color.White;
            panel2.Controls.Add(pb4);
            pb4.Hide();

            //マップの土台になるピクチャーボックスの設定
            if (width_max > 7)
            {
                pb2.Width = 10 + 10 * width_max + 40 * width_max;
                pb4.Width = 10 + 10 * width_max + 40 * width_max;
            }
            else
            {
                pb2.Width = 400;
                pb4.Width = 400;
            }
            if (height_max > 5)
            {
                pb2.Height = 10 + 10 * height_max + 40 * height_max;
                pb4.Height = 10 + 10 * height_max + 40 * height_max;
            }
            else
            {
                pb2.Height = 345;
                pb4.Height = 345;
            }

            //描画設定
            Bitmap canvas2 = new Bitmap(pb2.Width, pb2.Height);
            Graphics g2 = Graphics.FromImage(canvas2);
            Bitmap canvas4 = new Bitmap(pb4.Width, pb4.Height);
            Graphics g4 = Graphics.FromImage(canvas4);

            //動的配列
            data = new int[height_max + 1, width_max + 1];
            d_node_count = new int[100];
            b_node_count = new int[100];

            //ルート(木構造)
            Node root1 = null, root2 = null;

            //データ格納変数に値を入れる
            int y = 0;
            rs = new System.IO.StringReader(content);
            while (rs.Peek() > -1)
            {
                int x = 0;
                string t = rs.ReadLine();
                for (int k = 0; k < t.Length; k++)
                {
                    if (Char.IsDigit(t[k]))
                    {
                        if (t[k] == '0')
                            data[y, x++] = 1;
                        else if (t[k] == '1')
                            data[y, x++] = 0;
                        else
                            data[y, x++] = t[k] - 48;
                        if (t[k] == '2')
                        {
                            start_x = x-1;
                            start_y = y;
                        }
                    }
                }
                while (x < width_max)
                    data[y, x++] = 0;
                y++;
            }
            //一度通っているか記録するbool配列の定義
            bool[,,] width = width = new bool[1,height_max + 1, width_max];
            bool[,,] height = height = new bool[1,height_max, width_max + 1];

            Pen pen = new Pen(Color.FromArgb(255, 255, 0, 0), 10);
            Queue<int> queue_x = new Queue<int>();
            Queue<int> queue_y = new Queue<int>();
            Queue<int> Parents = new Queue<int>();
            queue_x.Enqueue(start_x);
            queue_y.Enqueue(start_y);
            Parents.Enqueue(4);

            //時間計測開始
            sw.Start();
            //深さ優先探索
            if (!depth_first_search(start_x, start_y, width, height, 0, null, ref root1, g2, pen))
                return 2;
            //時間計測終了
            sw.Stop();
            label3.Text = "探索時間 " + sw.Elapsed;

            sw = new System.Diagnostics.Stopwatch();

            //一度通っているか記録するbool配列を再定義
            width = new bool[1, height_max + 1, width_max];
            height = new bool[1, height_max, width_max + 1];
            Node[] n = new Node[1];
            n[0] = null;

            //時間計測開始
            sw.Start();
            //幅優先探索
            breadth_first_search(queue_x, queue_y, width, height, width_max, height_max, 0, Parents, n, ref root2, g4, pen);
            //時間計測終了
            sw.Stop();
            label4.Text = "探索時間 " + sw.Elapsed;

            root1.button.BackColor = Color.Blue;
            root2.button.BackColor = Color.Blue;

            //描画設定
            Bitmap canvas1 = new Bitmap(pb1.Width, pb1.Height);
            Graphics g1 = Graphics.FromImage(canvas1);
            Bitmap canvas3 = new Bitmap(pb3.Width, pb3.Height);
            Graphics g3 = Graphics.FromImage(canvas3);

            pen = new Pen(Color.FromArgb(255, 0, 0, 0), 3);
            d_branch_draw(root1, g1, pen);
            b_branch_draw(root2, g3, pen);

            d_maze(width_max, height_max);
            b_maze(width_max, height_max);

            g1.Dispose();
            g2.Dispose();
            g3.Dispose();
            g4.Dispose();
            pb1.Image = canvas1;
            pb2.Image = canvas2;
            pb3.Image = canvas3;
            pb4.Image = canvas4;

            //ラベルの設定
            label3.Show();

            //フォームをリサイズ
            this.Size = new Size(500, 500);

            //ウィンドウ上にあるコントロールをすべて非表示
            label1.Hide();
            label2.Hide();
            tb.Hide();
            bt3.Hide();
            bt4.Hide();
            bt5.Hide();
            bt9.Hide();

            //作成成功時に表示するメッセージ
            MessageBox.Show("木構造と迷路の回答を表示します",
             "成功",
             MessageBoxButtons.OK);

            return 0;
        }
예제 #15
0
        public FrameForm(Screen s)
        {
            InitializeComponent();

            /* Set Form Positioning in Secondary Window */
            this.Left = s.Bounds.Left;
            this.Top = s.Bounds.Top;
            this.Size = s.Bounds.Size;
            this.WindowState = FormWindowState.Maximized;

            /* Create Right Click Menu */
            ContextMenu cxtMnu = new ContextMenu();

            this.mi_playCtrl = new MenuItem("Pause", mi_playCtrl_Clicked);
            cxtMnu.MenuItems.Add(this.mi_playCtrl);
            cxtMnu.MenuItems.Add("-");
            cxtMnu.MenuItems.Add("Close Frame", delegate(object sndr, EventArgs e) { this.Close(); });

            this.ContextMenu = cxtMnu;

            /* Load Image Settings */
            this.t_imgTransition = new Timer();
            this.t_imgTransition.Tick += t_imgTransition_Tick;
            LoadSettings();

            /* Initiate Picture Boxes */
            #if DEBUG
            System.Diagnostics.Debug.Print("Initialize picbx_visible");
            #endif
            img_idx = 0;
            picbx_visible = new PictureBox();
            picbx_visible.Parent = this;
            picbx_visible.Size = this.Size;
            picbx_visible.Location = new Point(0, 0);
            picbx_visible.Hide();
            if (imageList.Length > 0)
                picbx_visible.Image = Image.FromFile(imageList[0]);

            #if DEBUG
            System.Diagnostics.Debug.Print("Initialize picbx_next");
            #endif
            picbx_next = new PictureBox();
            picbx_next.Parent = this;
            picbx_next.Size = this.Size;
            picbx_next.Location = new Point(0, 0);
            picbx_next.Hide();
            if (imageList.Length > 1)
                picbx_next.Image = Image.FromFile(imageList[1]);
            #if DEBUG
            System.Diagnostics.Debug.Print(picbx_next.Parent.ToString());
            #endif

            picbx_visible.FitContainer();
            picbx_visible.Center();
            picbx_visible.Show();

            Properties.Settings.Default.SettingsSaving += delegate(object sndr, CancelEventArgs e){ LoadSettings(); };

            /* Start Timer */
            this.t_imgTransition.Start();
        }
예제 #16
0
 void waitForThread()
 {
     canClose = false;
     Bitmap bmp = Screenshot.TakeSnapshot(panel1);
     BitmapFilter.GaussianBlur(bmp, 1);
     PictureBox pb = new PictureBox();
     panel1.Controls.Add(pb);
     pb.Image = bmp;
     pb.Dock = DockStyle.Fill;
     pb.BringToFront();
     progressBar1.BringToFront();
     progressBar1.Visible = true;
     button1.Enabled = false;
     button2.Enabled = false;
     button3.Enabled = false;
     listBox1.Enabled = false;
     while (t.IsAlive)
     {
         Application.DoEvents();
         progressBar1.Maximum = Maximum;
         int value = Progress + Crypt.Progress;
         if (value > Maximum) value = Maximum;
         progressBar1.Value = value;
     }
     pb.Hide();
     button1.Enabled = true;
     button2.Enabled = true;
     button3.Enabled = true;
     progressBar1.Visible = false;
     canClose = true;
     File.Delete("_temp.$$$");
     MessageBox.Show("fin");
 }