Sorry, there are no translations available at the moment.

"UI" - Interface Usager

Description

Dans ce tutoriel, nous allons améliorer l'interface usager de l'application.

Solution de départ

La solution de départ est disponible ici

Démonstration

http://tjtechno.com/demo/ui/

Code supplémentaire

Fonctions pour modifier l'image d'un employé

 
   #region Modify the employe picture
 
        private void _photoPictureBox_DoubleClick(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();
            openFileDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            openFileDialog.Filter = "Fichiers Images (*.gif, *.bmp, *.jpg, *.jpeg)"
                 + "|*.gif;*.bmp;*.jpg;*.jpeg|Tous les fichiers (*.*)|*.*";
 
            if (openFileDialog.ShowDialog(this) == DialogResult.OK)
            {
                string FileName = openFileDialog.FileName;
 
                try
                {
                    Image image = Image.FromFile(FileName, true);
                    CurrentEmployee.Photo = imageToByteArray(image);
                    image.Dispose();
                }
                catch (System.IO.FileNotFoundException)
                {
                    MessageBox.Show("There was an error opening the bitmap." +
                        "Please check the path.");
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message);
                }
            }
        }
 
        public byte[] imageToByteArray(System.Drawing.Image imageIn)
        {
            MemoryStream ms = new MemoryStream();
            imageIn.Save(ms, System.Drawing.Imaging.ImageFormat.Gif);
            return ms.ToArray();
        }
 
        #endregion
 
 

Exercices

Formulaire de produits

  • Exercice 1 : Faire fonctionner l'item de menu qui permet d'ouvrir le formulaire "ProductForm.cs"
  • Exercice 2 : Faire fonctionner l'ajout et la suppression de produit

Solution finale

Disponible ici

Liens

Icônes

http://www.crystalxp.net

http://www.everaldo.com/crystal/