Esempio n. 1
0
        private void bpLoad_Click(object sender, EventArgs e)
        {
            SetEtatBp(false);
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "Projet PJA (*.xml)|*.xml";
            DialogResult result = dlg.ShowDialog();

            if (result == DialogResult.OK)
            {
                FileStream file = File.Open(dlg.FileName, FileMode.Open);
                try {
                    projet             = (Projet) new XmlSerializer(typeof(Projet)).Deserialize(file);
                    nomProjet.Text     = dlg.SafeFileName;
                    mode.SelectedIndex = projet.Mode;
                    int y = projet.Cy;
                    nbCols.Value   = projet.Cx;
                    nbLignes.Value = y;
                    projet.Init();
                }
                catch (Exception ex) {
                    ShowException(ex);
                }
                file.Close();
            }
            SetEtatBp(true);
        }
Esempio n. 2
0
        public void MajProjet(Projet prj, bool newCpc)
        {
            int tx = pictureBox.Width = prj.Cx * 8;
            int ty = pictureBox.Height = prj.Cy * 16;

            if (newCpc)
            {
                bitmapCpc = new BitmapCpc(tx, ty, prj.Mode);
            }
            bmp = new Bitmap(tx, ty);
            pictureBox.Image  = bmp;
            bmpLock           = new LockBitmap(bmp);
            vScrollBar.Height = ty;
            vScrollBar.Left   = tx + 3;
            hScrollBar.Width  = tx;
            hScrollBar.Top    = ty + 3;
            if (autoRecalc.Checked)
            {
                bpRecalc_Click(this, null);
            }
            else
            {
                Render();
            }
        }
Esempio n. 3
0
 public EditImages(Projet prj)
 {
     InitializeComponent();
     for (int i = 0; i < 16; i++)
     {
         // Générer les contrôles de "couleurs"
         colors[i]             = new Label();
         colors[i].BorderStyle = BorderStyle.FixedSingle;
         colors[i].Location    = new Point(4 + i * 48, 564);
         colors[i].Size        = new Size(40, 32);
         colors[i].Tag         = i;
         colors[i].Click      += ClickColor;
         Controls.Add(colors[i]);
         // Générer les contrôles de "bloquage couleur"
         lockColors[i]          = new CheckBox();
         lockColors[i].Location = new Point(16 + i * 48, 598);
         lockColors[i].Size     = new Size(20, 20);
         lockColors[i].Tag      = i;
         lockColors[i].Click   += ClickLock;
         Controls.Add(lockColors[i]);
     }
     dataImage = prj.ImageData;
     MajProjet(prj, true);
     projet                   = prj;
     radioFit.Checked         = true;
     methode.SelectedIndex    = 0;
     matrice.SelectedIndex    = 0;
     renderMode.SelectedIndex = 0;
     zoomLevel.SelectedIndex  = 0;
     bpEditMode_CheckedChanged(null, null);
     UpdateListe(-1);
     Valid = true;
     dlgImportImage.Filter = "Images (*.scr, *.bin, *.bmp, *.gif, *.png, *.jpg)|*.scr;*.bin;*.bmp;*.gif;*.png;*.jpg";
     dlgLoadPal.Filter     = "Fichier palette (*.pal)|*.pal";
 }
Esempio n. 4
0
        public EditZones(Projet prj)
        {
            InitializeComponent();
            int tx = pictureBox.Width = prj.Cx * 8;
            int ty = pictureBox.Height = prj.Cy * 16;

            bitmapCPC        = new BitmapCpc(tx, ty, prj.Mode);
            pictureBox.Image = new Bitmap(tx, ty);
            bmpLock          = new LockBitmap(pictureBox.Image as Bitmap);

            penWhite.DashStyle  = System.Drawing.Drawing2D.DashStyle.DashDotDot;
            typeZone.DataSource = System.Enum.GetValues(typeof(Zone.TypeZone));
        }
Esempio n. 5
0
 public EditMap(Projet prj)
 {
     InitializeComponent();
     projet           = prj;
     dataMap          = prj.MapData;
     grilleX          = pictureMap.Width;
     grilleY          = pictureMap.Height;
     pictureMap.Image = new Bitmap(grilleX, grilleY);
     gfx = Graphics.FromImage(pictureMap.Image);
     UpdateImage();
     editZones = new EditZones(prj);
     Valid     = true;
     foreach (Image img in projet.ImageData.listImg)
     {
         listImage.Items.Add(img);
     }
 }