Ejemplo n.º 1
0
        //------------------------------------------------------------------------------------------------------------------------------------//

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            try
            {
                Ofd.Title            = "Select a file";
                Ofd.InitialDirectory = @"C:\";
                Ofd.Filter           = "Select Image|*.jpg;*.jpeg;*.png;";
                Ofd.FileName         = "Select a file";
                DialogResult result = Ofd.ShowDialog();
                if (result == DialogResult.OK)
                {
                    txtImage.Text = Ofd.FileName;
                    Image img       = Image.FromFile(Ofd.FileName);
                    Image ResizeImg = ResizeImage(img, 221, 150);
                    ImageData = (byte[])(new ImageConverter()).ConvertTo(ResizeImg, typeof(byte[]));
                    FileStream fs     = new FileStream(Ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
                    long       Length = ImageData.Length;
                    int        Ibyte  = fs.Read(ImageData, 0, Convert.ToInt32(Length));
                    fs.Close();

                    #region Commented because save image in a fix size so first resize then save
                    //FileInfo fiImage = new FileInfo(Ofd.FileName);
                    //FileStream fs = new FileStream(Ofd.FileName, FileMode.Open, FileAccess.Read, FileShare.Read);
                    //long Length = fiImage.Length;
                    //ImageData = new byte[Convert.ToInt32(Length)];
                    //int Ibyte = fs.Read(ImageData, 0, Convert.ToInt32(Length));
                    //fs.Close();
                    #endregion Commented because save image in a fix size so first resize then save
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
 private void GestionnaireFichier_Click(object sender, EventArgs e)
 {
     Ofd.Filter = "CSV|*.csv";
     if (Ofd.ShowDialog() == DialogResult.OK)
     {
         CheminFichier.Text = Ofd.FileName;
     }
 }
Ejemplo n.º 3
0
        private void OpenBtn_Click(object sender, EventArgs e)
        {
            if (Ofd.ShowDialog() == DialogResult.OK)
            {
                ResetForm();

                Program.api.ApkPath = Ofd.FileName;

                OpenApk();
            }
        }
Ejemplo n.º 4
0
 private bool LoadPrologue()
 {
     return(QuerySaveIfNeeded() && Ofd.ShowDialog(this) == DialogResult.OK);
 }