Пример #1
0
        }//end of assigning space property

        public void Create_Process(Control.ControlCollection c)
        {
            process_Image = new PictureBox();
            process_Image.Load("book.png");
            process_Image.SizeMode = PictureBoxSizeMode.StretchImage;
            if (size <= 5)
            {
                block_Per           = (size / memory.bestfit_block[8, 0]) * 100;
                orig_Process_Height = (memory.bestfit_block[8, 2] / 100) * block_Per;
            }
            else if (size > 500)
            {
                orig_Process_Height = 100;
            }
            else
            {
                for (int i = 0; i < 9; i++)
                {
                    if (size >= memory.bestfit_block[i + 1, 0] && size <= memory.bestfit_block[i, 0])
                    {
                        block_Per           = (size / memory.bestfit_block[i, 0]) * 100;
                        orig_Process_Height = (memory.bestfit_block[i, 2] / 100) * block_Per;
                        break;
                    }
                }
            }
            Image img = process_Image.Image;

            img.RotateFlip(RotateFlipType.Rotate90FlipNone);
            process_Image.Image     = img;
            process_Image.Size      = new Size(Convert.ToInt16(orig_Process_Height), 100);
            process_Image.BackColor = Color.Transparent;
            process_Image.Location  = new Point(12, 350);
            c.Add(process_Image);
            process_Image.BringToFront();
        }//end of creating process Image method
Пример #2
0
        private void AgregarCartaRival(Respuesta respuesta)
        {
            if (this.InvokeRequired)
            {
                this.Invoke(new Action(() => {
                    PictureBox pictureBox = new PictureBox();

                    pictureBox.Location  = new System.Drawing.Point(x2, y2);
                    pictureBox.Name      = "pictureBox" + i + 1;
                    pictureBox.Size      = new System.Drawing.Size(100, 150);
                    pictureBox.TabIndex  = 4;
                    pictureBox.BackColor = Color.Transparent;
                    pictureBox.SizeMode  = PictureBoxSizeMode.StretchImage;
                    pictureBox.TabStop   = false;


                    CambiarImagen(respuesta.carta.Nombre, pictureBox);
                    this.Controls.Add(pictureBox);
                    pictureBox.BringToFront();
                    cartas.Add(pictureBox);
                    x2 += 25;
                }));
            }
        }
Пример #3
0
        public void AtResimKutusuOlustur()
        {
            {
tekrar:
                int sayi = rnd.Next(0, 63);
                if (DogruMu[sayi] == false)
                {
                    PictureBox pb = new PictureBox();
                    pb.Width = 50; pb.Height = 50;
                    pb.Image = ımageList1.Images[2];
                    Point konum = new Point(labelListesi[sayi].Left, labelListesi[sayi].Top);
                    pb.Location   = konum;
                    DogruMu[sayi] = true;
                    ResimKutuListesi.Add(pb);
                    this.Controls.Add(pb);
                    pb.BringToFront();
                    sayac++;
                }
                else
                {
                    goto tekrar;
                }
            }
        }
Пример #4
0
        // Updates display to accomodate the new cards
        protected virtual void UpdateDisplay(bool faceDown = false)
        {
            // Figuring out how many cards there are
            int numCards = hand.Count();

            // Setting up new picture box
            Card       newCard   = hand.Last();
            PictureBox newPicBox = new PictureBox();

            newPicBox.SizeMode   = PictureBoxSizeMode.StretchImage;
            newPicBox.ClientSize = Card.cardSize;
            newPicBox.Image      = (faceDown) ? Card.backImage : newCard.cardImage; // back image if facedown, otherwise face image

            // Add picture box to the list of picboxes and master form's control list
            picBoxes.Add(newPicBox);
            newPicBox.BringToFront();
            master.Controls.Add(newPicBox);

            // setting UI variables for placement
            int center        = master.Width / 2;
            int startPosition = center - (spacing * numCards / 2);

            // Setting location of each picturebox
            foreach (PictureBox pbx in picBoxes)
            {
                pbx.Location = new Point(startPosition, handPosition);

                startPosition += spacing;
            }

            // Updating sum labels
            lblSum.Text = "Sum: " + Convert.ToString(sum);

            // Refreshing form
            master.Refresh();
        }
Пример #5
0
        public void GenerarDetectorZona(int posx, int posy, string tipo, int sizepx, string name, bool mover, int idDetector, Image img, string identificador, string dispositivo, string tipoDispositivo, string figura)
        {
            //NameZoneForm form = new NameZoneForm();
            //form.ShowDialog();


            PictureBox p = new PictureBox();

            p.Location = new Point(posx, posy);
            pictureBox1.Controls.Add(p);
            p.BringToFront();
            if (figura == "Círculo")
            {
                var path = new System.Drawing.Drawing2D.GraphicsPath();
                path.AddEllipse(0, 0, sizepx, sizepx);

                p.Region = new Region(path);
            }
            else
            {
                p.Size = new Size(sizepx, sizepx);
            }

            p.Tag       = tipo + "*" + idDetector.ToString() + "*" + identificador + "*" + sizepx.ToString() + "*" + name.Trim() + "*" + dispositivo + "*" + tipoDispositivo + "*" + figura;
            p.Image     = img;
            p.SizeMode  = PictureBoxSizeMode.StretchImage;
            p.BackColor = Color.Transparent;
            p.Draggable(mover);
            p.MouseHover += new EventHandler(Panel_Hover);
            p.MouseLeave += new EventHandler(Panel_Leave);
            if (mover)
            {
                p.MouseUp     += new MouseEventHandler(Panel_Click);
                p.DoubleClick += new EventHandler(Panel_DoubleClick);
            }
        }
Пример #6
0
        private void MakeSuperFood(PictureBox super, SnakeBody snake)
        {
            bool remake;

            do
            {
                remake         = false;
                x              = rand.Next(26);
                y              = rand.Next(26);
                super.Location = new Point(x * 20 + 10, y * 20 + 10);
                form.Controls.Add(super);
                super.BringToFront();
                super.Visible    = true;
                superFoodLocator = new Rectangle(super.Location.X + super.Width / 2, super.Location.Y + super.Height / 2, 2, 2);
                for (int i = 0; i < snake.tail.Count - 1; i++)
                {
                    if (snake.tail[i].Bounds.IntersectsWith(superFoodLocator))
                    {
                        remake = true;
                        break;
                    }
                }
            } while (remake);
        }
 //Revisa las vidas restantes del jugador y reposiciona los elementos.
 private void CheckLife()
 {
     //Verificar vidas de usuario
     if (GameData.Lives == 0)
     {
         MessageBox.Show("Juego terminado.",
                         "Arkanoid", MessageBoxButtons.OK);
         //Reiniciar datos para permitir juego nuevo
         ControlMenu menu = new ControlMenu();
         GameData.Lives       = 3;
         GameData.GameScore   = 0;
         GameData.GameStarted = false;
         //cambiar de userControl
         ((frmGame)this.Parent).ShowControl(menu);
     }
     else
     {
         //Reiniciar posición de bola
         cpbPlayer.Top = Height - cpbPlayer.Height - 80; cpbPlayer.Left = (Width / 2) - (cpbPlayer.Width / 2);
         ball.Top      = cpbPlayer.Top - ball.Height;
         ball.Left     = cpbPlayer.Left + cpbPlayer.Width / 2 - ball.Width / 2;
         ball.BringToFront();
     }
 }
        internal void AddCard(Card card, bool isDealer)
        {//display the card
            //Add Picture box with new card,
            PictureBox pictureBox = new PictureBox();

            pictureBox.Image = card.GetImage();
            //pictureBox.Image = Images.ace_of_clubs;
            if (!isDealer)
            {
                PlayerPoint.X      += cardXchange;
                PlayerPoint.Y      += 8;
                pictureBox.Location = PlayerPoint;

                //ADD FUNCTION HERE
                // lblPlayerHandScore.Text = game.player.score.ToString();
                updatePlayerHandScoreLabel(game.playerList[game.currentHand - 1]);
                playerPics.Add(pictureBox);
            }
            else
            {
                DealerPoint.X          += cardXchange;
                DealerPoint.Y          += 8;
                pictureBox.Location     = DealerPoint;
                lblDealerHandScore.Text = game.dealer.score.ToString();
                if (dealerPics.Count() == 1)
                {
                    pictureBox.Image = Images.back;
                }
                dealerPics.Add(pictureBox);
            }
            pictureBox.Size      = new Size(80, 100);
            pictureBox.SizeMode  = PictureBoxSizeMode.StretchImage;
            pictureBox.BackColor = Color.White;
            Controls.Add(pictureBox);
            pictureBox.BringToFront();
        }
Пример #9
0
 public void InitializeSprite()
 {
     if (fplayNo == 1)
     {
         Image = Properties.Resources.player1;
     }
     else if (fplayNo == 2)
     {
         Image = Properties.Resources.player2;
     }
     else
     {
         Image = Properties.Resources.playervs2;
     }
     Sprite = new PictureBox
     {
         Tag       = "player",
         Size      = size,
         BackColor = Color.Transparent,
         Image     = this.Image,
         SizeMode  = PictureBoxSizeMode.StretchImage
     };
     Sprite.BringToFront();
 }
Пример #10
0
        private void DropShield()
        {
            // Create a new PictureBox element to store the shield image
            PictureBox shield = new PictureBox();

            shield.Image = Properties.Resources.shield;

            // Setting the size of the image into an autosize
            shield.SizeMode = PictureBoxSizeMode.AutoSize;

            // Setting the position based on the Client's width and height
            shield.Left = rnd.Next(15, this.ClientSize.Width - shield.Width);
            shield.Top  = rnd.Next(60, this.ClientSize.Height - shield.Height);

            // Giving the image a tag as the identifier
            shield.Tag = "shieldIcon";

            // Add it to the list
            shieldList.Add(shield);

            this.Controls.Add(shield);  // Add the shield to the screen
            shield.BringToFront();      // Bring the shield to the front
            player.BringToFront();      // Bring the player to the front
        }
Пример #11
0
        public PictureBox AddImage(Image image, int x, int y)
        {
            PictureBox pb = new PictureBox();

            pb.MouseMove  += new MouseEventHandler(this.CreatedControl_MouseMove);
            pb.MouseEnter += new EventHandler(this.CreatedControl_MouseEnter);
            pb.MouseLeave += new EventHandler(this.CreatedControl_MouseLeave);
            pb.MouseDown  += new MouseEventHandler(this.CreatedControl_MouseDown);
            pb.MouseUp    += new MouseEventHandler(this.CreatedControl_MouseUp);
            pb.Parent      = this.pnlReceptical;
            pb.Top         = y;
            pb.Left        = x;
            pb.Image       = image;
            pb.SizeMode    = PictureBoxSizeMode.Normal;
            pb.Height      = pb.Image.Height;
            pb.Width       = pb.Image.Width;
            pb.Cursor      = Cursors.SizeAll;
            pb.BackColor   = Color.Transparent;
            pb.BringToFront();
            pb.Show();
            pb.BackColor = Color.Transparent;

            return(pb);
        }
Пример #12
0
        private void Control_MouseMove(object sender, MouseEventArgs e)
        {
            PictureBox pb = ((PictureBox)sender);

            if (!_isDraging)
            {
                return;
            }

            int x = pb.Location.X + e.X - _diffPoint.Value.X;
            int y = pb.Location.Y + e.Y - _diffPoint.Value.Y;

            if (x <= 0)
            {
                x = 0;
            }
            if (y <= 0)
            {
                y = 0;
            }
            pb.Location     = new Point(x, y);
            panel1.Location = new Point(x, y);
            pb.BringToFront();
        }
Пример #13
0
 private void PlaceObstacles()                                                                                                             // PlaceObstacles method
 {
     for (int i = 0; i < Library.GlobalVariables.obstacleStats.GetLength(0); i++)                                                          // For every obstacle in the obstacleStats array
     {
         Label      lbl       = this.Controls.Find("label" + Library.GlobalVariables.obstacleStats[i][0], true).FirstOrDefault() as Label; // Find the label of the square the obstacle should be placed at
         int        obstacleX = Convert.ToInt32(lbl.Location.X) - 9;                                                                       // Finds the x of the label and subtracts 9 to space it out from the label
         int        obstacleY = Convert.ToInt32(lbl.Location.Y) + 7;                                                                       // Finds the y of the label and adds 7 to space it out from the label
         PictureBox obstacle  = new PictureBox();                                                                                          // Creates a new PictureBox
         if (Library.GlobalVariables.obstacleStats[i][1] < 0)                                                                              // If the obstacle moves the player back
         {
             obstacle.Image = Properties.Resources.badObstacle;                                                                            // Set the image to a stop sign
         }
         else // If the obstacle moves the player forward
         {
             obstacle.Image = Properties.Resources.goodObstacle; // Set the image to a forwards arrow
         }
         obstacle.Location = new Point(obstacleX, obstacleY);    // Set the location of the obstacle to the two variables created above
         obstacle.Size     = new Size(17, 17);                   // Set the obstacle size to 17x17 (like all the other sprites)
         obstacle.SizeMode = PictureBoxSizeMode.Zoom;            // Set the obstacle's scaling mode to zoom
         this.Controls.Add(obstacle);                            // Add the obstacle to the form
         obstacle.Show();                                        // Show the obstacle
         obstacle.BringToFront();                                // Bring the obstacle to the front
     }
 }
Пример #14
0
        private void button6_Click(object sender, EventArgs e)
        {
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                Label txt1 = new Label();

                txt1.Text = ofd.FileName;
                this.splitContainer3.Panel1.Controls.Add(txt1);
                txt1.Location  = new Point(5, 100);
                txt1.Size      = new System.Drawing.Size(200, 200);
                txt1.ForeColor = Color.DarkOrange;


                Label txt2 = new Label();
                txt2.Text = ofd.SafeFileName;
                this.splitContainer4.Panel2.Controls.Add(txt2);
                txt2.Location  = new Point(20, 100);
                txt2.Size      = new System.Drawing.Size(200, 200);
                txt2.ForeColor = Color.DarkOrange;
                Random     _random = new Random();
                int        numx    = _random.Next(300);
                int        numy    = _random.Next(300);
                PictureBox pb1     = new PictureBox();
                pb1.Image = Image.FromFile("../circle2.png");

                pb1.Location = new Point(numx, numy);


                //pb1.Location = new Point(100, 100);
                pb1.BringToFront();
                pb1.Size = new Size(60, 60);
                //this.Controls..Add(pb1);
                this.splitContainer4.Panel1.Controls.Add(pb1);
                pb1.Visible = true;
            }
        }
Пример #15
0
        private void drawGame()
        {
            /* Initialize dimensions */
            dims = new MainGUIDimensions(data.width, data.height);

            /* Initialize bitmaps */
            borderImg       = new Bitmap(dims.window.Size.Width, dims.window.Size.Height);
            spotsImg        = new Bitmap(data.width * 16, data.height * 16);
            border.Size     = new Size(dims.window.Size.Width, dims.window.Size.Height);
            border.Location = new Point(0, 0);
            spots.Size      = new Size(data.width * 16, data.height * 16);
            spots.Location  = new Point(dims.border_vl.Size.Width, dims.menuBar.Size.Height + 2 * dims.border_tl.Size.Height + dims.border_vl.Size.Height);

            /* Draw border */
            drawOnBitmap(dims.border_tl.Location.X, dims.border_tl.Location.Y, Resources.border_tl, borderImg);
            drawOnBitmap(dims.border_tr.Location.X, dims.border_tr.Location.Y, Resources.border_tr, borderImg);
            drawOnBitmap(dims.border_vl.Location.X, dims.border_vl.Location.Y, Resources.border_vt, borderImg);
            drawOnBitmap(dims.border_vr.Location.X, dims.border_vr.Location.Y, Resources.border_vt, borderImg);
            drawOnBitmap(dims.border_ml.Location.X, dims.border_ml.Location.Y, Resources.border_ml, borderImg);
            drawOnBitmap(dims.border_mr.Location.X, dims.border_mr.Location.Y, Resources.border_mr, borderImg);
            drawOnBitmap(dims.border_bl.Location.X, dims.border_bl.Location.Y, Resources.border_bl, borderImg);
            drawOnBitmap(dims.border_br.Location.X, dims.border_br.Location.Y, Resources.border_br, borderImg);

            for (int i = 0; i < data.width; i++)
            {
                drawOnBitmap(dims.border_tl.Size.Width + i * 16, dims.border_tl.Location.Y, Resources.border_h, borderImg);
                drawOnBitmap(dims.border_tl.Size.Width + i * 16, dims.border_ml.Location.Y, Resources.border_h, borderImg);
                drawOnBitmap(dims.border_tl.Size.Width + i * 16, dims.border_bl.Location.Y, Resources.border_h, borderImg);
            }

            for (int i = 0; i < data.height; i++)
            {
                drawOnBitmap(dims.border_ml.Location.X, dims.border_ml.Location.Y + dims.border_ml.Size.Height + i * 16, Resources.border_v, borderImg);
                drawOnBitmap(dims.border_mr.Location.X, dims.border_ml.Location.Y + dims.border_ml.Size.Height + i * 16, Resources.border_v, borderImg);
            }

            /* Draw spots */
            resetSpots();

            /* After images are created, set all locations */
            this.ClientSize = dims.window.Size;
            menu.Location   = dims.menuBar.Location;
            menu.Size       = dims.menuBar.Size;

            border.Image = borderImg;
            border.SendToBack();
            spots.Image = spotsImg;
            spots.BringToFront();

            for (int i = 0; i < 3; i++)
            {
                mineCount[i].Size     = dims.mineCount[i].Size;
                mineCount[i].Location = dims.mineCount[i].Location;
            }

            for (int i = 0; i < 3; i++)
            {
                time[i].Size     = dims.time[i].Size;
                time[i].Location = dims.time[i].Location;
            }

            face.Size     = dims.face.Size;
            face.Location = dims.face.Location;
        }
Пример #16
0
            public void stak(int st1, Point point, GeneralForm fsv, PictureBox border, int komanda, int number)
            {
                //audio = LoadAudio();
                this.komanda = komanda;
                this.fsv     = fsv;
                this.border  = border;
                workForm     = fsv;
                if (workForm.InvokeRequired)
                {
                    workForm.BeginInvoke((MethodInvoker) delegate
                    {
                        stak(st1, point, fsv, border, komanda, number);
                    });
                }
                else
                {
                    // pc.Size = (number == 0) ? NewSize(160, 500) : NewSize(160, 400);//было 500
                    pc.Location  = point;
                    pc.BackColor = Color.Transparent;
                    pc.SizeMode  = PictureBoxSizeMode.StretchImage;
                    // pc.BorderStyle = BorderStyle.Fixed3D;
                    pc.Parent = border;
                    // pc.Visible = false;
                    lb = new Label()
                    {
                        Parent    = border,
                        Location  = new Point(point.X + 20, point.Y - 60),
                        Size      = NewSize(150, 50) + new Size(40, 0),
                        Name      = "oneuse",
                        ForeColor = Color.Gold,
                        BackColor = Color.Transparent,
                        Font      = new Font("arial", 12),
                        TextAlign = ContentAlignment.TopCenter,
                    };
                    pc.BringToFront();
                    lb.BringToFront();
                    lbSt = new Label() //метка размера ставки
                    {
                        Parent    = border,
                        Location  = new Point(point.X + 20, point.Y - 30),
                        Size      = NewSize(150, 50) + new Size(40, 0),
                        Name      = "oneuse",
                        ForeColor = Color.Gold,
                        BackColor = Color.Transparent,
                        Font      = new Font("arial", 18),
                        TextAlign = ContentAlignment.TopCenter,
                    };
                    if (komanda != 0 && komanda < 4)
                    {
                        lb.Text = komanda + " стол";
                    }
                    if (komanda > 5)
                    {
                        lbSt.Visible = false;

                        lb.Text     = "Выигрыш команды:" + fsv.predUs.team[number - 1].name + " составил " + komanda + " айкэш";
                        this.number = number;
                        lb.Location = NewRelPoint(0, 410);
                        lb.Size     = new Size(700, 70);
                        lb.Font     = new Font("arial", 11);
                        if (fsv.predUs.team[this.number - 1].name == fsv.myTeam.name)
                        {
                            this.fsv.iQash1.Text = this.fsv.steck.team[this.fsv.iQash1.number].iQash.ToString() + " IQ";
                        }
                    }
                    //lb.BringToFront();
                    if (komanda == 0)
                    {
                        lbSt.Visible = false;
                    }
                    try
                    {
                        frameCount   = 0;
                        indexToPaint = 0;
                        //if (video != null)
                        {
                            video?.Stop();
                            video?.Dispose();
                        }
                        video = new Video(Application.StartupPath + String.Format("\\Video\\Chips\\st{0}.mp4", st1), false); //вместо st25 поставить st1
                                                                                                                             //size = video.Size;
                                                                                                                             //this.Size = size;
                        video.Owner = pc;
                        pc.Size     = (number == 0) ? NewSize(252, 580) : NewSize(223, 322);
                        video.Size  = pc.Size;
                        //video.Ending += Video_Ending;
                        pc.Visible = true;
                        pc.BringToFront();
                        pc.Refresh();
                        try
                        {
                            frameCount = video.Duration;
                        }
                        catch
                        {  }
                        //if (video != null)
                        video.Play();
                    }
                    catch (Exception ex)
                    {
                        //MessageBox.Show("Ошибка загрузки видео:" + Environment.NewLine + "st1 = " + st1 + Environment.NewLine + ex.StackTrace + Environment.NewLine + Marshal.GetLastWin32Error());
                    }

                    /*img = Properties.Resources._12_50int2;
                     * dimension = new FrameDimension(img.FrameDimensionsList[0]);
                     * frameCount = img.GetFrameCount(dimension);
                     * //arr = new Bitmap[frameCount];
                     * int[] frame = new int[] { 12, 24, 36, 47, 58, 69, 80, 90, 100, 110, 120, 130 };
                     *
                     * frameCount = frame[st1 - 1]; */
                    /*
                     * for (int i = 0; i < frameCount; i++)
                     * {
                     *  img.SelectActiveFrame(dimension, i);
                     *  var bit = new Bitmap(img);
                     *  arr[i] = bit;
                     * }
                     */
                    stavka         = st1;
                    timer.Interval = 15;
                    timer.Tick    += new EventHandler(timer_Tick);
                    //audio.Play();
                    timer.Start();
                }
            }
Пример #17
0
        //---------------------------------------------------------------
        protected override void MyCreateControle(
            CCreateur2iFormulaireV2 createur,
            C2iWnd wnd,
            Control parent,
            IFournisseurProprietesDynamiques fournisseurProprietes)
        {
            m_createur = createur;

            if (WndSnmp == null)
            {
                return;
            }

            CCreateur2iFormulaireV2.AffecteProprietesCommunes(WndSnmp, m_panel);
            parent.Controls.Add(m_panel);
            m_wndChamp = createur.CreateControle(WndSnmp.FieldZone, m_panel, fournisseurProprietes) as CWndFor2iWndVariable;
            m_wndChamp.OnValueChanged += new EventHandler(OnChampValueChanged);
            CChampCustom champCustom = null;

            if (WndSnmp.FieldZone.ChampCustom != null)
            {
                champCustom = WndSnmp.FieldZone.ChampCustom;
            }
            if (champCustom != null)
            {
                switch (champCustom.TypeDonneeChamp.TypeDonnee)
                {
                case TypeDonnee.tBool:
                    m_controleSnmp         = new CheckBox();
                    m_controleSnmp.Enabled = false;
                    break;

                case TypeDonnee.tDate:
                case TypeDonnee.tDouble:
                case TypeDonnee.tEntier:
                case TypeDonnee.tString:
                    m_controleSnmp = new C2iTextBox();
                    if (WndSnmp.FieldZone.MultiLine)
                    {
                        ((C2iTextBox)m_controleSnmp).Multiline = true;
                    }
                    ((C2iTextBox)m_controleSnmp).LockEdition          = true;
                    ((C2iTextBox)m_controleSnmp).OnChangeLockEdition += new EventHandler(CWndForWndChampSnmp_OnChangeLockEdition);
                    break;

                default:
                    break;
                }
                if (m_controleSnmp != null)
                {
                    m_panel.Controls.Add(m_controleSnmp);
                    m_controleSnmp.Location  = WndSnmp.SnmpZone.Position;
                    m_controleSnmp.Size      = WndSnmp.SnmpZone.Size;
                    m_controleSnmp.BackColor = WndSnmp.SnmpZone.BackColor;
                    m_controleSnmp.ForeColor = WndSnmp.SnmpZone.ForeColor;
                    switch (WndSnmp.SnmpZone.DockStyle)
                    {
                    case sc2i.formulaire.EDockStyle.Bottom:
                        m_controleSnmp.Dock = DockStyle.Bottom;
                        break;

                    case sc2i.formulaire.EDockStyle.Fill:
                        m_controleSnmp.Dock = DockStyle.Fill;
                        break;

                    case sc2i.formulaire.EDockStyle.Left:
                        m_controleSnmp.Dock = DockStyle.Left;
                        break;

                    case sc2i.formulaire.EDockStyle.None:
                        m_controleSnmp.Dock = DockStyle.None;
                        break;

                    case sc2i.formulaire.EDockStyle.Right:
                        m_controleSnmp.Dock = DockStyle.Right;
                        break;

                    case sc2i.formulaire.EDockStyle.Top:
                        m_controleSnmp.Dock = DockStyle.Top;
                        break;

                    default:
                        break;
                    }
                }
            }
            m_imageWarning = new PictureBox();
            m_panel.Controls.Add(m_imageWarning);
            if (m_controleSnmp != null)
            {
                m_imageWarning.Location = new Point(m_controleSnmp.Location.X + m_controleSnmp.Size.Width - 16,
                                                    m_controleSnmp.Location.Y);
            }
            if (m_controleSnmp != null)
            {
                m_imageWarning.Size = new Size(16, m_controleSnmp.Height);
            }
            m_imageWarning.BackColor = wnd.BackColor;
            m_imageWarning.SizeMode  = PictureBoxSizeMode.CenterImage;
            m_imageWarning.Image     = Properties.Resources.alerte;
            m_imageWarning.BringToFront();
            m_imageWarning.Visible = false;

            m_imageTools = new PictureBox();
            m_panel.Controls.Add(m_imageTools);
            m_imageTools.Dock      = DockStyle.Right;
            m_imageTools.BackColor = wnd.BackColor;
            if (m_controleSnmp != null)
            {
                m_imageTools.Size = new Size(16, m_controleSnmp.Height);
            }
            m_imageTools.SendToBack();
            m_imageTools.SizeMode = PictureBoxSizeMode.CenterImage;
            m_imageTools.Image    = Properties.Resources.tools;
            m_imageTools.Click   += new EventHandler(m_imageTools_Click);
            m_imageTools.Cursor   = Cursors.Hand;


            if (WndSnmp.IsHorizontal)
            {
                if (m_wndChamp != null && m_wndChamp.Control != null)
                {
                    m_wndChamp.Control.Dock = DockStyle.Fill;
                    m_wndChamp.Control.BringToFront();
                }
                if (m_controleSnmp != null)
                {
                    m_controleSnmp.Dock = DockStyle.Right;
                    if (parent is sc2i.formulaire.win32.datagrid.CControlEncapsuleWndControl)
                    {
                        m_controleSnmp.Width = parent.Width / 2;
                    }
                }
                m_imageWarning.Dock = DockStyle.Right;
                m_imageTools.Dock   = DockStyle.Right;
                m_imageWarning.SendToBack();
                m_imageTools.SendToBack();
            }
            else
            {
                if (m_wndChamp != null && m_wndChamp.Control != null)
                {
                    m_wndChamp.Control.Dock = DockStyle.Fill;
                    m_wndChamp.Control.BringToFront();
                }
                if (m_controleSnmp != null)
                {
                    m_controleSnmp.Dock = DockStyle.Bottom;
                }
                m_imageWarning.Dock = DockStyle.Right;
                m_imageTools.Dock   = DockStyle.Right;
                m_imageWarning.SendToBack();
                m_imageTools.SendToBack();
            }
            parent.SizeChanged += new EventHandler(parent_SizeChanged);
        }
Пример #18
0
        public List <char> construir(PictureBox picMapBackground, PictureBox[] mapTiles, string mapBlueprint)
        {
            /*  Tile placement as children from the Map Background. Tile background also turns transparent using this method (instead of inheriting
             * the parent control background). */
            double startingWidthTiles = 0.050;
            double spacingTiles       = 0.075;
            double widthPercentage    = startingWidthTiles;
            double heightPercentage;

            for (int i = 0; i < mapTiles.Length; i++)
            {
                tile           = new PictureBox();
                tile.Size      = new Size(25, 25);
                tile.BackColor = Color.Transparent;
                picMapBackground.Controls.Add(tile);
                tile.Tag = "tile";
                tile.BringToFront();
                mapTiles[i] = tile;

                if (i < 11)
                {
                    heightPercentage = 0.79;
                }

                else if (i > 11 && i < 23)
                {
                    heightPercentage = 0.47;
                }

                else
                {
                    heightPercentage = 0.15;
                }

                if (i == 11)
                {
                    widthPercentage      = startingWidthTiles + 10 * spacingTiles;
                    mapTiles[i].Location = new Point(Convert.ToInt32(picMapBackground.Width * widthPercentage),
                                                     Convert.ToInt32(picMapBackground.Height * 0.63));
                }
                else if (i == 23)
                {
                    widthPercentage      = startingWidthTiles;
                    mapTiles[i].Location = new Point(Convert.ToInt32(picMapBackground.Width * startingWidthTiles),
                                                     Convert.ToInt32(picMapBackground.Height * 0.31));
                }
                else
                {
                    mapTiles[i].Location = new Point(Convert.ToInt32(picMapBackground.Width * widthPercentage),
                                                     Convert.ToInt32(picMapBackground.Height * heightPercentage));

                    if (i > 11 && i < 23)
                    {
                        //  Starts from the right
                        widthPercentage -= spacingTiles;
                    }
                    else
                    {
                        widthPercentage += spacingTiles;
                    }
                }
            }

            definirIcones(mapTiles, mapBlueprint);
            return(symbols);
        }
Пример #19
0
        public void cardClick(object sender, EventArgs e)
        {
            bool isfirstT = true;

            if (isfirstT)
            {
                isfirstT = false;
                playTime.Start();
            }
            PictureBox selectedC = (PictureBox)sender;

            Console.WriteLine($"You clicked {(Card)selectedC.Tag}");
            bool isCardFromDealer = false;
            bool Replaceable      = false;
            bool moveToSlotAble   = false;

            for (int i = 0; i < 7; i++)
            {
                if (lines[i].Contains(selectedC))
                {
                    for (int j = 0; j < lines[i].Count; j++)
                    {
                        if (lines[i][j] == selectedC && j + 1 <= lines[i].Count - 1)
                        {
                            Replaceable = true;
                            break;
                        }
                    }
                }
            }
            for (int i = 0; i < 7; i++)
            {
                if (lines[i].Contains(glowingC))
                {
                    for (int j = 0; j < lines[i].Count; j++)
                    {
                        if (lines[i][j] == glowingC && j + 1 == lines[i].Count)
                        {
                            moveToSlotAble = true;
                            break;
                        }
                    }
                }
            }
            if (glowingC == null || glowingC.Tag == null)
            {
                glowImg         = Resize(glowImg, 95, 145);
                glowPB.Location = new Point(selectedC.Location.X - 5, selectedC.Location.Y - 5);
                glowPB.Image    = glowImg;
                glowPB.Size     = glowImg.Size;
                Controls.Add(glowPB);
                glowingC = selectedC;
            }//Apply glow
            else
            {
                if (selectedC == glowingC)
                {
                    Controls.Remove(glowPB);
                    glowingC = null;
                    Console.WriteLine($"You removed the glow from {(Card)selectedC.Tag}");
                }//Remove glow on same card

                else if (deck.areDifferentcolors((Card)selectedC.Tag, (Card)glowingC.Tag) && (deck.areFollowingNum((Card)glowingC.Tag, (Card)selectedC.Tag)) && !Replaceable && !(selectedC.Location.X == 600 && selectedC.Location.Y == 50) && (!(selectedC.Equals(slotSpb) || selectedC.Equals(slotHpb) || selectedC.Equals(slotDpb) || selectedC.Equals(slotCpb))))
                {
                    Controls.Remove(glowPB);
                    for (int i = 0; i < dealer.Count; i++)
                    {
                        if (((PictureBox)dealer[i].Tag).Equals(glowingC))
                        {
                            glowingC.Location = new Point(selectedC.Location.X, selectedC.Location.Y + 20);
                            glowingC.BringToFront();
                            Console.WriteLine($"You moved {(Card)glowingC.Tag} from the dealer to under {(Card)selectedC.Tag}");
                            openCard         = null;
                            isCardFromDealer = true;
                            for (int j = 0; j < 7; j++)
                            {
                                if (lines[j].Contains(selectedC))
                                {
                                    lines[j].Add((PictureBox)dealer[i].Tag);
                                }
                            }
                            Controls.Remove(dealer[i]);
                            dealer.Remove(dealer[i]);
                            break;
                        }
                    }//Move Card from dealer
                    if ((glowingC.Equals(slotSpb) || glowingC.Equals(slotHpb) || glowingC.Equals(slotDpb) || glowingC.Equals(slotCpb)) && !isCardFromDealer)
                    {
                        removeFromSlots(selectedC);
                    }
                    else if (!isCardFromDealer)
                    {
                        int          j, k = 0;
                        PictureBox[] tempCs = new PictureBox[0];
                        for (int i = 0; i < 7; i++)
                        {
                            if (lines[i].Contains(glowingC))
                            {
                                for (j = 0; j < lines[i].Count; j++)
                                {
                                    if (lines[i][j] == glowingC)
                                    {
                                        tempCs = new PictureBox[lines[i].Count - j];
                                        for (k = 0; k < tempCs.Length; k++)
                                        {
                                            tempCs[k] = lines[i][j + k];
                                        }
                                    }
                                }
                                for (int u = 0; u < tempCs.Length; u++)
                                {
                                    tempCs[u].Location = new Point(selectedC.Location.X, selectedC.Location.Y + (u + 1) * 20);
                                    tempCs[u].BringToFront();
                                    lines[i].Remove(tempCs[u]);
                                }
                                if (lines[i].Count != 0)
                                {
                                    try
                                    {
                                        lines[i][lines[i].Count - 1].Image  = ((PictureBox)lines[i][lines[i].Count - 1].Tag).Image;
                                        lines[i][lines[i].Count - 1].Click += cardClick;
                                        lines[i][lines[i].Count - 1].Tag    = ((PictureBox)lines[i][lines[i].Count - 1].Tag).Tag;
                                        bruhCount++;
                                    }
                                    catch { }
                                }
                            }
                        }
                        for (int i = 0; i < 7; i++)
                        {
                            if (lines[i].Contains(selectedC))
                            {
                                for (int r = 0; r < tempCs.Length; r++)
                                {
                                    lines[i].Add(tempCs[r]);
                                }
                            }
                        }
                        k = 0;
                        Console.WriteLine($"You moved {(Card)glowingC.Tag} and {tempCs.Length - 1} other Cards to under {(Card)selectedC.Tag}");
                    } //Move Cards from line to line
                    movesCounter++;
                    glowingC = null;
                }
                else if (((Card)selectedC.Tag).getNum() == ((Card)glowingC.Tag).getNum() - 1 && (((Card)selectedC.Tag).getType() == ((Card)glowingC.Tag).getType()) && (selectedC.Equals(slotSpb) || selectedC.Equals(slotHpb) || selectedC.Equals(slotDpb) || selectedC.Equals(slotCpb)))
                {
                    Controls.Remove(glowPB);
                    for (int i = 0; i < dealer.Count; i++)
                    {
                        if (((PictureBox)dealer[i].Tag).Equals(glowingC))
                        {
                            glowingC.Location = new Point(selectedC.Location.X, selectedC.Location.Y);
                            glowingC.BringToFront();
                            Controls.Remove(dealer[i]);
                            dealer.Remove(dealer[i]);
                            openCard = null;
                            Console.WriteLine($"You moved {(Card)glowingC.Tag} to slot {((Card)selectedC.Tag).getType()}");
                            isCardFromDealer = true;
                            break;
                        }
                    }//Move from dealer to slot
                    if (!isCardFromDealer && moveToSlotAble)
                    {
                        glowingC.Location = new Point(selectedC.Location.X, selectedC.Location.Y);
                        glowingC.BringToFront();
                        for (int i = 0; i < 7; i++)
                        {
                            if (lines[i].Contains(glowingC))
                            {
                                lines[i].Remove(glowingC);
                                if (lines[i].Count != 0)
                                {
                                    try
                                    {
                                        lines[i][lines[i].Count - 1].Image  = ((PictureBox)lines[i][lines[i].Count - 1].Tag).Image;
                                        lines[i][lines[i].Count - 1].Click += cardClick;
                                        lines[i][lines[i].Count - 1].Tag    = ((PictureBox)lines[i][lines[i].Count - 1].Tag).Tag;
                                        bruhCount++;
                                    }
                                    catch { }
                                }
                            }
                        }
                        Console.WriteLine($"You moved {(Card)glowingC.Tag} to slot {((Card)selectedC.Tag).getType()}");
                    }//Move from lines to slot
                    {
                        if (((Card)selectedC.Tag).getType() == "Spade")
                        {
                            slotSCount++;
                            slotSpb = glowingC;
                        }
                        else if (((Card)selectedC.Tag).getType() == "Heart")
                        {
                            slotHCount++;
                            slotHpb = glowingC;
                        }
                        else if (((Card)selectedC.Tag).getType() == "Diamond")
                        {
                            slotDCount++;
                            slotDpb = glowingC;
                        }
                        else if (((Card)selectedC.Tag).getType() == "Club")
                        {
                            slotCCount++;
                            slotCpb = glowingC;
                        }
                    }
                    glowingC = null;
                    movesCounter++;
                }
                else if (!(selectedC.Equals(slotSpb) || selectedC.Equals(slotHpb) || selectedC.Equals(slotDpb) || selectedC.Equals(slotCpb)))
                {
                    glowImg         = Resize(glowImg, 95, 145);
                    glowPB.Location = new Point(selectedC.Location.X - 5, selectedC.Location.Y - 5);
                    glowPB.Image    = glowImg;
                    glowPB.Size     = glowImg.Size;
                    Controls.Add(glowPB);
                    glowingC = selectedC;
                }
            }
            if (glowingC != null)
            {
                Console.WriteLine($"GlowingC is {(Card)glowingC.Tag}");
            }
            checkWin();
        }
Пример #20
0
        private void CreateGame()
        {
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MaximizeBox     = false;
            // CREATE PLAYERS
            {
                int x, y;
                if (STARTING_DISTACE < GameSettings.mapWidth - STARTING_DISTACE) // Try to place players far from each other if possible
                {
                    x = _random.Next(STARTING_DISTACE, GameSettings.mapWidth - STARTING_DISTACE);
                    y = _random.Next(STARTING_DISTACE, GameSettings.mapHeigth - STARTING_DISTACE);
                }
                else
                {
                    x = _random.Next(0, GameSettings.mapWidth);
                    y = _random.Next(0, GameSettings.mapHeigth);
                }

                Player player1 = players[0];
                Player player2 = players[1];
                player1.InitPlayer(!player1.hider, 0, 0);
                player2.InitPlayer(!player2.hider, x, y);
            }

            // CREATE MAP
            Game = new Game(GameSettings.mapWidth, GameSettings.mapHeigth, GameSettings.tileTypes, this);



            // DRAW MAP AND UI

            this.Controls.Clear();
            LoadGraphics();


            // DRAW PLAYER

            PictureBox p1 = createPictureBox(players[0], 1, 1);

            p1.Tag = "player1";
            p1.BringToFront();
            ((Panel)getComponentOnSide(true, "mapScreen")).Controls.Add(p1);



            PictureBox p2 = createPictureBox(players[1], 1, 1);

            p2.Tag = "player2";
            p2.BringToFront();
            ((Panel)getComponentOnSide(false, "mapScreen")).Controls.Add(p2);

            // DRAW TILES AROUND THE PLAYER
            foreach (Player player in players)
            {
                Point mapPoint;
                for (int y = 0; y < 3; y++) // draw 3x3 tiles around the player
                {
                    for (int x = 0; x < 3; x++)
                    {
                        mapPoint = OutOfBounds(player.posX + x - 1, player.posY + y - 1); // -1 because player is in [1;1]
                        drawTile(player.onLeft, x, y, Game.gameMap[mapPoint.Y, mapPoint.X]);
                    }
                }

                drawBiomsAround(player);
            }

            // START TIMERS
            everyFrame.Start();
            foreach (Player player in players)
            {
                player.timer.Start();
            }

            this.Focus();           // Defocus from any previous control
            this.KeyPreview = true; // Activate functions like KeyPressed
        }
Пример #21
0
        private void add_poster(Control this_panel, int n, string[,] path)
        {
            for (int j = 0; j < n; j++)
            {
                Panel parent_panel = new Panel()
                {
                    Name = path[j, 1],
                    Size = new Size(190, 260),
                    //Location = new Point(lx, ly),
                    BackColor = Color.Transparent,
                    Parent    = this_panel,
                    Margin    = new Padding(4, 4, 4, 4),
                };

                this_panel.Controls.Add(parent_panel);


                Panel panel = new Panel()
                {
                    Name      = path[j, 1],
                    Size      = new Size(180, 260),
                    Location  = new Point(15, 0),
                    BackColor = Color.Transparent,
                    Parent    = parent_panel,
                    Margin    = new Padding(4, 4, 4, 4),
                };

                parent_panel.Controls.Add(panel);
                panel.BringToFront();
                panel.Click      += new EventHandler(contentpanel_click);
                panel.MouseHover += new EventHandler(contentpanel_hover);
                panel.MouseLeave += new EventHandler(contentpanel_leave);


                var pic = new PictureBox()
                {
                    Name     = path[j, 1],
                    Size     = new Size(180 - 20, 240 - 20),
                    Location = new Point(5, 5),
                    Parent   = panel,
                    Anchor   = (AnchorStyles.None),
                };
                panel.Controls.Add(pic);
                pic.BringToFront();

                pic.Click      += new EventHandler(contentpic_click);
                pic.MouseHover += new EventHandler(contentpic_hover);
                pic.MouseLeave += new EventHandler(contentpic_leave);
                pic.Image       = new Bitmap(path[j, 0]);
                pic.SizeMode    = PictureBoxSizeMode.StretchImage;

                Panel panel_over_pic = new Panel()
                {
                    Name      = path[j, 1],
                    Size      = new Size(180 - 20, 240 - 20),
                    Location  = new Point(0, 0),
                    Parent    = pic,
                    BackColor = Color.Transparent,
                };

                pic.Controls.Add(panel_over_pic);
                panel_over_pic.BringToFront();
                panel_over_pic.Click      += new EventHandler(panel_over_pic_click);
                panel_over_pic.MouseHover += new EventHandler(panel_over_pic_hover);
                panel_over_pic.MouseLeave += new EventHandler(panel_over_pic_leave);


                Panel genre_plate = create_flowpanel("genre_plate", 190, 40, Color.Transparent, panel);
                genre_plate.Location = new Point(0, 230);

                int           k     = 0;
                int           kx    = 10;
                List <string> genre = get_genre(path[j, 1]);
                while (true)
                {
                    Label gen = new Label()
                    {
                        Name        = k.ToString(),
                        Text        = genre[k],
                        Location    = new Point(kx, 230),
                        Font        = new Font("Neuropolitical", 8, FontStyle.Regular),
                        MaximumSize = new Size(50, 0),
                        Parent      = genre_plate,
                        BackColor   = Color.Transparent,
                        TextAlign   = ContentAlignment.MiddleCenter,
                        ForeColor   = Color.FromArgb(0, 10, 30),
                        AutoSize    = true,
                    };

                    genre_plate.Controls.Add(gen);
                    gen.BringToFront();
                    if (k == 2)                                                          //print 3
                    {
                        break;
                    }
                    Label slash = new Label()
                    {
                        Name      = k.ToString(),
                        Text      = "|",
                        Location  = new Point(kx + 41, 230),
                        Font      = new Font("Neuropolitical", 8, FontStyle.Regular),
                        AutoSize  = true,
                        Parent    = genre_plate,
                        BackColor = Color.Transparent,
                        ForeColor = Color.FromArgb(0, 10, 30),
                        TextAlign = ContentAlignment.MiddleCenter,
                    };
                    genre_plate.Controls.Add(slash);
                    slash.BringToFront();
                    k++;
                    kx = kx + 46;
                }
            }
        }
Пример #22
0
        private void pictureBox1_MouseUp_1(object sender, MouseEventArgs e)
        {
            mouseIsDown = false;
            switch (state)
            {
            case Shapes.Rectangles:

                mydraw.Shapes.Add(r);
                r.Draw(mydraw.graphic);
                break;

            case Shapes.Line:
                mydraw.Shapes.Add(l);
                l.Draw(mydraw.graphic);
                break;

            case Shapes.Ellipse:
                mydraw.Shapes.Add(c);
                c.Draw(mydraw.graphic);
                break;

            case Shapes.Circle:
                mydraw.Shapes.Add(circle);
                circle.Draw(mydraw.graphic);
                break;

            case Shapes.Lines:
            case Shapes.Rubber:
                if (bi.points.Length >= 2)
                {
                    mydraw.Shapes.Add(bi);
                    bi.Draw(mydraw.graphic);
                }
                break;

            case Shapes.DrawWord:
                if (flag1 == 2)
                {
                    mydraw.Shapes.Add(d);
                    d.Draw(mydraw.graphic);
                    flag1     = 0;
                    text.Text = null;
                }
                break;

            case Shapes.Heart:
                mydraw.Shapes.Add(a);
                a.Draw(mydraw.graphic);
                break;

            case Shapes.Pentagon:
                mydraw.Shapes.Add(p);
                p.Draw(mydraw.graphic);
                break;

            case Shapes.Hexagon:
                mydraw.Shapes.Add(pe);
                pe.Draw(mydraw.graphic);
                break;

            case Shapes.Fivestar:
                mydraw.Shapes.Add(fiveStar);
                fiveStar.Draw(mydraw.graphic);
                break;

            case Shapes.Triangle:
                mydraw.Shapes.Add(t);
                t.Draw(mydraw.graphic);
                break;

            case Shapes.SelectMove:
                if (move.MouseDown_Point.X.Equals(move.MouseUp_Point.X) || move.MouseDown_Point.Y.Equals(move.MouseUp_Point.Y))
                {
                    break;
                }
                this.pictureBox = move.InitilaPicture(pictureBox1);
                pictureBox1.Controls.Add(pictureBox);
                move.DrawWhile(mydraw.graphic);
                flag = 1;
                pictureBox1.Refresh();
                pictureBox.MouseDown   += pictureBox_MouseDown;
                pictureBox.MouseMove   += pictureBox_MouseMove;
                pictureBox.MouseUp     += pictureBox_MouseUp;
                pictureBox.Paint       += pictureBox_Paint;
                toolStrip1.ItemClicked += toolStrip1_ItemClicked;
                MouseClick             += FormMain_MouseClick;
                pictureBox.BringToFront();
                flag1 = 0;
                pictureBox.Refresh();
                break;

            default: break;
            }
        }
Пример #23
0
 public void BringToFront()
 {
     pictureBox.BringToFront();
 }
Пример #24
0
        //---------------------------------------------------------------
        protected override void MyCreateControle(
            CCreateur2iFormulaireV2 createur,
            C2iWnd wnd,
            Control parent,
            IFournisseurProprietesDynamiques fournisseurProprietes)
        {
            if (WndOrange == null)
            {
                return;
            }

            CCreateur2iFormulaireV2.AffecteProprietesCommunes(WndOrange, m_panel);
            parent.Controls.Add(m_panel);
            m_wndForLabel = createur.CreateControle(WndOrange.LabelZone, m_panel, fournisseurProprietes) as CWndFor2iLabel;
            m_wndChamp    = createur.CreateControle(WndOrange.FieldZone, m_panel, fournisseurProprietes) as CWndFor2iWndVariable;
            CChampCustom champCustom = null;

            if (WndOrange.FieldZone.ChampCustom != null)
            {
                champCustom = WndOrange.FieldZone.ChampCustom;
            }
            //m_wndValeurOrange = createur.CreateControle(WndOrange.OrangeZone, m_panel, fournisseurProprietes) as CWndFor2iLabel;
            if (champCustom != null)
            {
                switch (champCustom.TypeDonneeChamp.TypeDonnee)
                {
                case TypeDonnee.tBool:
                    m_controleOrange         = new CheckBox();
                    m_controleOrange.Enabled = false;
                    break;

                case TypeDonnee.tDate:
                case TypeDonnee.tDouble:
                case TypeDonnee.tEntier:
                case TypeDonnee.tString:
                    m_controleOrange = new C2iTextBox();
                    if (WndOrange.FieldZone.MultiLine)
                    {
                        ((C2iTextBox)m_controleOrange).Multiline = true;
                    }
                    ((C2iTextBox)m_controleOrange).LockEdition          = true;
                    ((C2iTextBox)m_controleOrange).OnChangeLockEdition += new EventHandler(CWndForWndChampOrange_OnChangeLockEdition);
                    break;

                default:
                    break;
                }
                if (m_controleOrange != null)
                {
                    m_panel.Controls.Add(m_controleOrange);
                    m_controleOrange.Location  = WndOrange.OrangeZone.Position;
                    m_controleOrange.Size      = WndOrange.OrangeZone.Size;
                    m_controleOrange.BackColor = WndOrange.OrangeZone.BackColor;
                    m_controleOrange.ForeColor = WndOrange.OrangeZone.ForeColor;
                    switch (WndOrange.OrangeZone.DockStyle)
                    {
                    case sc2i.formulaire.EDockStyle.Bottom:
                        m_controleOrange.Dock = DockStyle.Bottom;
                        break;

                    case sc2i.formulaire.EDockStyle.Fill:
                        m_controleOrange.Dock = DockStyle.Fill;
                        break;

                    case sc2i.formulaire.EDockStyle.Left:
                        m_controleOrange.Dock = DockStyle.Left;
                        break;

                    case sc2i.formulaire.EDockStyle.None:
                        m_controleOrange.Dock = DockStyle.None;
                        break;

                    case sc2i.formulaire.EDockStyle.Right:
                        m_controleOrange.Dock = DockStyle.Right;
                        break;

                    case sc2i.formulaire.EDockStyle.Top:
                        m_controleOrange.Dock = DockStyle.Top;
                        break;

                    default:
                        break;
                    }
                }
            }
            m_imageWarning = new PictureBox();
            m_panel.Controls.Add(m_imageWarning);
            if (m_controleOrange != null)
            {
                m_imageWarning.Location = new Point(m_controleOrange.Location.X + m_controleOrange.Size.Width - 16,
                                                    m_controleOrange.Location.Y);
            }
            m_imageWarning.Size      = new Size(16, m_controleOrange.Height);
            m_imageWarning.BackColor = m_controleOrange.BackColor;
            m_imageWarning.SizeMode  = PictureBoxSizeMode.CenterImage;
            m_imageWarning.Image     = Properties.Resources.Warning;
            m_imageWarning.BringToFront();
            m_imageWarning.Visible = false;
        }
Пример #25
0
        private void initTopDraggedSignPictureBox() //args PictureBox...?????
        {
            startPoint = signPictureBox.Location;
            PictureBox newSignPictureBox = new PictureBox();

            signPictureBoxIsClicked     = true;
            newSignPictureBox.Image     = signPictureBox.Image;
            newSignPictureBox.Size      = signPictureBox.Size;
            newSignPictureBox.SizeMode  = PictureBoxSizeMode.StretchImage;
            newSignPictureBox.Location  = signPictureBox.Location;
            newSignPictureBox.BackColor = Color.WhiteSmoke;

            newSignPictureBox.MouseMove += (s, arg) =>
            {
                if (signPictureBoxIsClicked)
                {
                    newSignPictureBox.Left += signPictureBox.Location.X - startPoint.X;
                    newSignPictureBox.Top  += signPictureBox.Location.Y - startPoint.Y;
                }
            };
            newSignPictureBox.MouseClick += (s, arg) =>
            {
                if (signPictureBoxIsClicked)
                {
                    //if чтобы положить его сожно только в mainPB


                    signPictureBoxIsClicked  = false;
                    newSignPictureBox.Height = mainPictureBox.Height / 14;
                    newSignPictureBox.Width  = newSignPictureBox.Height;
                    SignDrawing addedSignDrawing = new SignDrawing();
                    addedSignDrawing.COORDINATS = newSignPictureBox.Location;
                    //signDrawings.AddLast(addedSignDrawing);
                    RoadDrawing.getRoadDrawing().signDrawings.AddLast(addedSignDrawing);
                    if (RoadDrawing.getRoadDrawing().signDrawings.Count == 4)
                    {
                        signPictureBox.Enabled = false;
                        signPictureBox.Image   = Image.FromFile("..\\..\\images\\not_enabled_sign_icon.png");
                    }
                    SetSignForm setSignForm = new SetSignForm(addedSignDrawing);
                    setSignForm.ShowDialog();
                    Road.getRoad().SIGNS.AddLast(addedSignDrawing.SIGN);
                    addedSignDrawing.getSignGraphic(Graphics.FromImage(newSignPictureBox.Image));
                    signsPictureBoxes.AddLast(newSignPictureBox);
                    newSignPictureBox.Invalidate(); newSignPictureBox.Invalidate(); newSignPictureBox.Invalidate();
                }
                else
                {
                    if (draggedSignPictureBoxIsClicked)
                    {
                        draggedSignPictureBoxIsClicked = false;
                        PictureBox pb = (PictureBox)s;
                        foreach (SignDrawing sd in RoadDrawing.getRoadDrawing().signDrawings)
                        {
                            if ((sd.COORDINATS.X == previousCoordinats.X) && (sd.COORDINATS.Y == previousCoordinats.Y))
                            {
                                sd.COORDINATS = pb.Location;
                            }
                        }
                    }
                    else
                    {
                        draggedSignPictureBoxIsClicked = true;
                        newSignPictureBoxMain          = signsPictureBoxes.Find((PictureBox)s).Value;
                        previousCoordinats             = newSignPictureBoxMain.Location;
                    }
                }
            };
            newSignPictureBox.DoubleClick += (s, arg) =>
            {
                draggedSignPictureBoxIsClicked = false;
                PictureBox pb = (PictureBox)s;
                foreach (SignDrawing sg in RoadDrawing.getRoadDrawing().signDrawings)
                {
                    if (sg.COORDINATS == pb.Location)
                    {
                        SetSignForm ssf = new SetSignForm(sg);
                        ssf.ShowDialog();
                        sg.getSignGraphic(Graphics.FromImage(pb.Image));
                        pb.Invalidate();
                    }
                }
                pb.Invalidate(); pb.Invalidate();
                newSignPictureBox.Invalidate(); newSignPictureBox.Invalidate(); newSignPictureBox.Invalidate();
            };

            newSignPictureBox.Paint += (s, arg) =>
            {
                PictureBox pb = (PictureBox)s;

                foreach (SignDrawing sg in RoadDrawing.getRoadDrawing().signDrawings)
                {
                    if (sg.COORDINATS.X == pb.Location.X && sg.COORDINATS.Y == pb.Location.Y)
                    {
                        sg.getSignGraphic(Graphics.FromImage(pb.Image));
                    }
                }
            };


            this.Controls.Add(newSignPictureBox);
            newSignPictureBoxMain = newSignPictureBox;
            signPictureBox.Image  = Image.FromFile("..\\..\\images\\sign_icon.png");
            newSignPictureBox.BringToFront();
        }
Пример #26
0
        public void CreateControls(Review review, int num, string kinds, Point location, string name)
        {
            switch (num)
            {
            case 1:
                //肉部品設定
                PictureBox meat = new PictureBox();
                //選択肢設定
                ComboBox direction = new ComboBox();
                //ラベル設定
                Label labelL = new Label();
                Font  font   = new Font("コーポレート・ロゴ(ラウンド)", 18);

                //labelL設定
                labelL.Font      = new Font(font.FontFamily, 16, FontStyle.Bold);
                labelL.Size      = new Size(220, 40);
                labelL.ForeColor = Color.White;
                labelL.BackColor = Color.Transparent;
                labelL.Parent    = meat;


                //回数設定
                TextBox countBox = new TextBox();
                countBox.Multiline = true;
                countBox.Size      = new Size(35, 25);
                countBox.TextAlign = HorizontalAlignment.Center;
                countBox.Font      = new Font(font.FontFamily, 16);
                countBox.KeyPress += new KeyPressEventHandler(countBox_KeyPress);
                countBox.BringToFront();

                review.MeatCount++;
                switch (name)
                {
                case "meat_0":
                    meat.Name       = "meat_" + review.MeatCount;
                    meat.Image      = Image.FromFile(review.FilePath + "\\images\\flowchart\\meat.png");
                    labelL.Text     = "うえに      マスすすむ";
                    labelL.Location = new Point(65, 25);
                    break;

                case "catfish_0":
                    meat.Name       = "catfish_" + review.MeatCount;
                    meat.Image      = Image.FromFile(review.FilePath + "\\images\\flowchart\\catfish.png");
                    labelL.Text     = "みぎに      マスすすむ";
                    labelL.Location = new Point(62, 20);
                    break;

                case "crab_0":
                    meat.Name       = "crab_" + review.MeatCount;
                    meat.Image      = Image.FromFile(review.FilePath + "\\images\\flowchart\\crab.png");
                    labelL.Text     = "みぎに      マスすすむ";
                    labelL.Location = new Point(62, 40);
                    break;

                case "shell_0":
                    meat.Name        = "shell_" + review.MeatCount;
                    meat.Image       = Image.FromFile(review.FilePath + "\\images\\flowchart\\shell.png");
                    labelL.Text      = "うえに      マスすすむ";
                    labelL.ForeColor = Color.Black;
                    labelL.Location  = new Point(65, 25);
                    break;
                }
                //肉
                meat.Size     = new Size(320, 79);
                meat.SizeMode = PictureBoxSizeMode.StretchImage;
                switch (review.MeatCount)
                {
                case 1:
                    meat.Location = new Point(0, 145);
                    if (name == "catfish_0")
                    {
                        countBox.Location = new Point(126, 165);        //20
                    }
                    else if (name == "crab_0")
                    {
                        countBox.Location = new Point(126, 185);        //40
                    }
                    else
                    {
                        countBox.Location = new Point(123, 170);        //25
                    }

                    countBox.Name = "count_1";
                    break;

                case 2:
                    meat.Location = new Point(0, 235);
                    if (name == "catfish_0")
                    {
                        countBox.Location = new Point(122, 255);
                    }
                    else if (name == "crab_0")
                    {
                        countBox.Location = new Point(122, 275);
                    }
                    else
                    {
                        countBox.Location = new Point(122, 260);
                    }
                    countBox.Name = "count_2";

                    break;

                case 3:
                    meat.Location = new Point(0, 330);
                    if (name == "catfish_0")
                    {
                        countBox.Location = new Point(122, 350);
                    }
                    else if (name == "crab_0")
                    {
                        countBox.Location = new Point(122, 370);
                    }
                    else
                    {
                        countBox.Location = new Point(122, 355);
                    }
                    countBox.Name = "count_3";
                    break;

                case 4:
                    meat.Location = new Point(0, 420);
                    if (name == "catfish_0")
                    {
                        countBox.Location = new Point(122, 440);
                    }
                    else if (name == "crab_0")
                    {
                        countBox.Location = new Point(122, 460);
                    }
                    else
                    {
                        countBox.Location = new Point(122, 445);
                    }
                    countBox.Name = "count_4";
                    break;

                default:
                    break;
                }
                meat.BackColor = Color.FromName("White");
                //追加
                review.panel4.Controls.Add(meat);
                review.panel4.Controls.Add(countBox);
                meat.BringToFront();
                countBox.BringToFront();

                break;

            case 2:
                //docat
                PictureBox Lcat = new PictureBox();
                PictureBox cat  = new PictureBox();
                PictureBox dog  = new PictureBox();

                NumericUpDown upT  = new NumericUpDown();
                Label         catL = new Label();
                font = new Font("コーポレート・ロゴ(ラウンド)", 18);
                //ループ回数テキストボックス設定
                upT.Text      = "1";
                upT.Name      = "loopCount";
                upT.Font      = new Font(font.FontFamily, 20);
                upT.TextAlign = HorizontalAlignment.Center;
                upT.Size      = new Size(45, 30);
                upT.Location  = new Point(50, 25);
                upT.Maximum   = 9;
                upT.KeyPress += countBox_KeyPress;
                upT.Parent    = Lcat;

                Label label = new Label();
                label.Text      = "回くりかえす";
                label.Font      = new Font(font.FontFamily, 20);
                label.Size      = new Size(142, 30);
                label.BackColor = Color.FromArgb(235, 235, 235);
                label.Location  = new Point(95, 30);
                label.Parent    = Lcat;

                Boolean flg = false;
                switch (name)
                {
                case "Lcat":
                    //ループネコブロック
                    if (review.ControlCount[0] != 1)
                    {
                        review.ControlCount[0]++;
                        review.ConCount++;
                        review.rank[0] = review.ConCount;
                        Lcat.SizeMode  = PictureBoxSizeMode.StretchImage;
                        Lcat.Name      = "Lcat1";
                        switch (review.ConCount)
                        {
                        case 1:
                            Lcat.Location = new Point(60, 130);
                            Lcat.Size     = new Size(300, 400);
                            flg           = true;
                            break;

                        case 2:
                            Lcat.Location = new Point(60, 250);
                            Lcat.Size     = new Size(300, 280);
                            flg           = true;
                            break;

                        default:
                            break;
                        }

                        Lcat.Image     = Image.FromFile(review.FilePath + "\\images\\docat\\Lcat.png");
                        Lcat.BackColor = Color.White;
                    }
                    if (flg == true)
                    {
                        review.singleCount[review.ConCount - 1] = 0;
                        //追加
                        review.panel4.Controls.Add(Lcat);
                        //追加コントロールの最前面配置
                        Lcat.BringToFront();
                        flg = false;
                    }
                    break;

                case "cat":
                    if (review.ControlCount[1] != 3)
                    {
                        if (review.ConCount == 3)
                        {
                            break;
                        }
                        review.ControlCount[1]++;
                        review.ConCount++;
                        review.rank[1] = review.ConCount;
                        cat.Size       = new Size(260, 120);
                        cat.SizeMode   = PictureBoxSizeMode.StretchImage;
                        cat.Name       = "cat1";
                        switch (review.ConCount)
                        {
                        case 1:
                            cat.Location = new Point(60, 130);
                            break;

                        case 2:
                            if (review.ControlCount[0] == 1)
                            {
                                cat.Location = new Point(105, 205);
                            }
                            else
                            {
                                cat.Location = new Point(60, 255);
                            }

                            break;

                        case 3:
                            if (review.ControlCount[0] == 1)
                            {
                                cat.Location = new Point(105, 335);
                            }
                            else
                            {
                                cat.Location = new Point(60, 380);
                            }
                            break;

                        default:
                            break;
                        }
                        cat.Image     = Image.FromFile(review.FilePath + "\\images\\docat\\cat.png");
                        cat.BackColor = Color.Transparent;
                        flg           = true;
                    }
                    if (flg == true)
                    {
                        review.singleCount[review.ConCount - 1] = 1;
                        //追加
                        review.panel4.Controls.Add(cat);
                        //追加コントロールの最前面配置
                        cat.BringToFront();
                        flg = false;
                    }
                    break;

                case "dog":
                    if (review.ControlCount[2] != 3)
                    {
                        if (review.ConCount == 3)
                        {
                            break;
                        }
                        review.ControlCount[2]++;
                        review.ConCount++;
                        review.rank[2] = review.ConCount;
                        dog.Size       = new Size(260, 120);
                        dog.SizeMode   = PictureBoxSizeMode.StretchImage;
                        dog.Name       = "dog1";
                        switch (review.ConCount)
                        {
                        case 1:
                            dog.Location = new Point(60, 130);
                            break;

                        case 2:
                            if (review.ControlCount[0] == 1)
                            {
                                dog.Location = new Point(105, 205);
                            }
                            else
                            {
                                dog.Location = new Point(60, 255);
                            }

                            break;

                        case 3:
                            if (review.ControlCount[0] == 1)
                            {
                                dog.Location = new Point(105, 335);
                            }
                            else
                            {
                                dog.Location = new Point(60, 380);
                            }

                            break;

                        default:
                            break;
                        }
                        dog.Image     = Image.FromFile(review.FilePath + "\\images\\docat\\dog.png");
                        dog.BackColor = Color.Transparent;
                        flg           = true;
                    }
                    if (flg == true)
                    {
                        review.singleCount[review.ConCount - 1] = 2;
                        //追加
                        review.panel4.Controls.Add(dog);
                        //追加コントロールの最前面配置
                        dog.BringToFront();
                        flg = false;
                    }
                    break;

                default:
                    break;
                }
                break;

            default:
                break;
            }
        }
Пример #27
0
 private void initTopDraggedTrafficLightPictureBox()
 {
     startPoint = trafficLightPictureBox.Location;
     trafficLightPictureBoxIsCLicked             = true;
     topDraggedTrafficLightPictureBox.Image      = trafficLightPictureBox.Image;
     topDraggedTrafficLightPictureBox.Size       = trafficLightPictureBox.Size;
     topDraggedTrafficLightPictureBox.SizeMode   = PictureBoxSizeMode.StretchImage;
     topDraggedTrafficLightPictureBox.Location   = trafficLightPictureBox.Location;
     topDraggedTrafficLightPictureBox.MouseMove += (s, arg) =>
     {
         if (trafficLightPictureBoxIsCLicked)
         {
             topDraggedTrafficLightPictureBox.Left += trafficLightPictureBox.Location.X - startPoint.X;
             topDraggedTrafficLightPictureBox.Top  += trafficLightPictureBox.Location.Y - startPoint.Y;
         }
     };
     topDraggedTrafficLightPictureBox.MouseClick += (s, arg) =>
     {
         if (trafficLightPictureBoxIsCLicked)
         {
             //if чтобы положить его сожно только в mainPB
             if (Road.getRoad().COUNTOFWAYS == 2)
             {
                 bottomTrafficLightPictureBox.Image    = TrafficLightDrawing.getTrafficLightDrawing().DEFAULTSTATEBOTTOM;
                 bottomTrafficLightPictureBox.Size     = new Size(topDraggedTrafficLightPictureBox.Width * 2, mainPictureBox.Height / 14);
                 bottomTrafficLightPictureBox.SizeMode = PictureBoxSizeMode.StretchImage;
                 bottomTrafficLightPictureBox.Location = new Point(topDraggedTrafficLightPictureBox.Location.X, mainPictureBox.Height - topDraggedTrafficLightPictureBox.Location.Y + bottomTrafficLightPictureBox.Height);
                 this.Controls.Add(bottomTrafficLightPictureBox);
                 bottomTrafficLightPictureBox.BringToFront();
             }
             trafficLightPictureBoxIsCLicked         = false;
             trafficLightPictureBox.Enabled          = false;
             trafficLightPictureBox.Image            = Image.FromFile("..\\..\\images\\not_enabled_traffic_light_icon.jpeg");
             topDraggedTrafficLightPictureBox.Height = mainPictureBox.Height / 14;
             topDraggedTrafficLightPictureBox.Width *= 2;
             topDraggedTrafficLightPictureBox.Image  = TrafficLightDrawing.getTrafficLightDrawing().DEFAULTSTATETOP;
             SetTrafficLightForm setTrafficLightForm = new SetTrafficLightForm(true);
             setTrafficLightForm.Visible = true;
             LinkedList <TrafficLight> t = Road.getRoad().TRAFFICLIGHTS;
             TrafficLightDrawing.getTrafficLightDrawing().COORDINATS.AddLast(new Point[] { topDraggedTrafficLightPictureBox.Location
                                                                                           , bottomTrafficLightPictureBox.Location });
         }
         else
         {
             if (draggedTrafficLightPictureBoxIsClicked)
             {
                 draggedTrafficLightPictureBoxIsClicked = false;
                 TrafficLightDrawing.getTrafficLightDrawing().COORDINATS.RemoveLast();
                 TrafficLightDrawing.getTrafficLightDrawing().COORDINATS.AddLast(new Point[] { topDraggedTrafficLightPictureBox.Location
                                                                                               , bottomTrafficLightPictureBox.Location });
             }
             else
             {
                 draggedTrafficLightPictureBoxIsClicked = true;
             }
         }
     };
     topDraggedTrafficLightPictureBox.DoubleClick += (s, arg) =>
     {
         draggedTrafficLightPictureBoxIsClicked = false;
         SetTrafficLightForm ssf = new SetTrafficLightForm(false);
         ssf.ShowDialog();
     };
     this.Controls.Add(topDraggedTrafficLightPictureBox);
     topDraggedTrafficLightPictureBox.BringToFront();
 }
Пример #28
0
        private void label1_Click(object sender, EventArgs e)
        {
            int  nbZones = 0;
            Zone zone    = new Zone();

            int ok = 0; //permet de savoir si une zone correspond
            int x  = MousePosition.X;
            int y  = MousePosition.Y;

            using (Graphics g = this.label1.CreateGraphics())
            {
                ok = 0;
                for (int i = 0; i < numMaxQuestion; i++)
                {
                    for (int j = 0; j < Questions[i].Zones.Count; j++)
                    {
                        if (Questions[i].numQuestion == numQuestion)
                        {
                            if (x > Questions[i].Zones[j].x && x <Questions[i].Zones[j].x + Questions[i].Zones[j].largeur && y> Questions[i].Zones[j].y && y < Questions[i].Zones[j].y + Questions[i].Zones[j].hauteur)
                            {
                                nbZones = Questions[i].Zones.Count;
                                zone    = Questions[i].Zones[j];
                                ok++;
                            }
                        }
                    }
                }
                if (ok == 1)
                {
                    PictureBox panel = new PictureBox();
                    panel.BackColor = Color.Green;
                    panel.Location  = new Point(Convert.ToInt32(zone.x + 0.05 * zone.largeur), Convert.ToInt32(zone.y + 0.05 * zone.hauteur));
                    panel.Size      = new Size(Convert.ToInt32(0.9 * zone.hauteur), Convert.ToInt32(0.9 * zone.largeur));
                    this.Controls.Add(panel);
                    panel.BringToFront();
                    res++;
                }
                else
                {
                    string            message = "Cette zone ne correspond pas";
                    string            caption = "Mauvaise zone";
                    MessageBoxButtons buttons = MessageBoxButtons.OK;
                    DialogResult      result;

                    // Displays the MessageBox.

                    result = MessageBox.Show(message, caption, buttons);
                }

                if (res == nbZones)
                {
                    foreach (Control ctrl in this.Controls)
                    {
                        if (ctrl.Name != "label1")
                        {
                            ctrl.BackColor = Color.Transparent;
                        }
                    }
                    InitializeComponent();
                }
            }
        }
Пример #29
0
        private void btn_dosyaAc_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd_ac = new OpenFileDialog();

            if (ofd_ac.ShowDialog() == DialogResult.OK)
            {
                bool resimMi = false;
                bool videoMu = false;
                try
                {
                    string dosyaTuru = Path.GetExtension(ofd_ac.FileName);
                    for (int i = 0; i < resimDosyalari.Length; i++)
                    {
                        if (dosyaTuru.ToLower() == "." + resimDosyalari[i].ToLower())
                        {
                            resimMi = true;
                            break;
                        }
                    }

                    if (!resimMi)
                    {
                        for (int i = 0; i < videoDosyalari.Length; i++)
                        {
                            if (dosyaTuru.ToLower() == videoDosyalari[i].ToLower())
                            {
                                videoMu = true;
                                break;
                            }
                        }
                    }

                    if (resimMi)
                    {
                        PictureBox pcr_ac = new PictureBox();

                        pcr_ac.ImageLocation = ofd_ac.FileName;
                        pcr_ac.SizeMode      = PictureBoxSizeMode.AutoSize;
                        pcr_ac.InitialImage  = null;
                        pcr_ac.Cursor        = Cursors.Hand;
                        this.AutoScroll      = true;

                        for (int i = 0; i < this.Controls.Count; i++)
                        {
                            this.Controls[i].Hide();
                        }

                        this.Controls.Add(pcr_ac);
                        pcr_ac.BringToFront();
                        (this.Parent as Telerik.WinControls.UI.RadPageViewPage).ToolTipText = ofd_ac.FileName;

                        if (ofd_ac.FileName.Length >= 20)
                        {
                            (this.Parent as Control).Text = ofd_ac.FileName.Substring(0, 20) + "...";
                        }
                        else
                        {
                            (this.Parent as Control).Text = ofd_ac.FileName;
                        }
                        pcr_ac.DoubleClick += delegate
                        {
                            if (pcr_ac.SizeMode == PictureBoxSizeMode.AutoSize)
                            {
                                pcr_ac.SizeMode = PictureBoxSizeMode.StretchImage;
                                pcr_ac.Dock     = DockStyle.Fill;
                            }
                            else
                            {
                                pcr_ac.SizeMode = PictureBoxSizeMode.AutoSize;
                                pcr_ac.Dock     = DockStyle.None;
                            }
                        };
                    }
                    else if (videoMu)
                    {
                        try
                        {
                            AxWMPLib.AxWindowsMediaPlayer ax_ac = new AxWMPLib.AxWindowsMediaPlayer();
                            this.Controls.Add(ax_ac);
                            ax_ac.BringToFront();
                            ax_ac.URL = ofd_ac.FileName;
                            ax_ac.Ctlcontrols.play();
                            ax_ac.Dock = DockStyle.Fill;
                            (this.Parent as Telerik.WinControls.UI.RadPageViewPage).ToolTipText = ofd_ac.FileName;

                            if (ofd_ac.FileName.Length >= 20)
                            {
                                (this.Parent as Control).Text = ofd_ac.FileName.Substring(0, 20) + "...";
                            }
                            else
                            {
                                (this.Parent as Control).Text = ofd_ac.FileName;
                            }
                            (this.Parent.Parent as Telerik.WinControls.UI.RadPageView).ControlRemoved += new ControlEventHandler((sender2, e2) => Usr_sayfa_ControlRemoved(sender2, e2, ax_ac, (this.Parent as Telerik.WinControls.UI.RadPageViewPage)));
                        }
                        catch
                        {
                            MessageBox.Show("Bu Dosya Türü Desteklenmiyor.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                    else
                    {
                        p = Process.Start(ofd_ac.FileName);
                        p.StartInfo.RedirectStandardOutput = true;
                        p.StartInfo.RedirectStandardInput  = true;
                        p.StartInfo.UseShellExecute        = true;
                        p.StartInfo.CreateNoWindow         = true;
                        p.StartInfo.WindowStyle            = ProcessWindowStyle.Maximized;
                        p.WaitForInputIdle();
                        SetParent(p.MainWindowHandle, this.Handle);
                        if (p.MainWindowHandle == (IntPtr)0)
                        {
                            throw null;
                        }
                        try
                        {
                            SetWindowLong(p.MainWindowHandle, GWL_STYLE, WS_VISIBLE);
                        }
                        catch { }
                        MoveWindow(p.MainWindowHandle, 0, 0, this.Width, this.Height, true);
                        (this.Parent as Telerik.WinControls.UI.RadPageViewPage).ToolTipText = p.MainWindowTitle;
                        if (p.MainWindowTitle.Length >= 20)
                        {
                            (this.Parent as Control).Text = p.MainWindowTitle.Substring(0, 20) + "...";
                        }
                        else
                        {
                            (this.Parent as Control).Text = p.MainWindowTitle;
                        }
                    }
                }
                catch
                {
                    try
                    {
                        p.Kill();
                    }
                    catch { }
                    MessageBox.Show("Bu Dosya Türü Desteklenmiyor.", "Uyarı", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Пример #30
0
 private void MasterThinForm_Load(object sender, EventArgs e)
 {
     Text = "農委會防檢局POS系統";
     pb_virtualKeyBoard.BringToFront();
 }