Beispiel #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;
            }
        }
Beispiel #2
0
 private void GestionnaireFichier_Click(object sender, EventArgs e)
 {
     Ofd.Filter = "CSV|*.csv";
     if (Ofd.ShowDialog() == DialogResult.OK)
     {
         CheminFichier.Text = Ofd.FileName;
     }
 }
Beispiel #3
0
        private void OpenBtn_Click(object sender, EventArgs e)
        {
            if (Ofd.ShowDialog() == DialogResult.OK)
            {
                ResetForm();

                Program.api.ApkPath = Ofd.FileName;

                OpenApk();
            }
        }
Beispiel #4
0
        private void btnCIMG_Click(object sender, EventArgs e)
        {
            this.Ofd.Multiselect = true;
            this.Ofd.Title       = "Selecionar Fotos";
            Ofd.InitialDirectory = @"C:\";
            Ofd.Filter           = "Images (*.BMP;*.JPG;*.GIF,*.PNG)|*.BMP;*.JPG;*.GIF;*.PNG;";
            Ofd.CheckFileExists  = true;
            Ofd.CheckPathExists  = true;
            Ofd.FilterIndex      = 2;
            Ofd.RestoreDirectory = true;
            Ofd.ReadOnlyChecked  = true;
            Ofd.ShowReadOnly     = true;

            DialogResult dr = this.Ofd.ShowDialog();

            if (dr == System.Windows.Forms.DialogResult.OK)
            {
                foreach (String arquivo in Ofd.FileNames)
                {
                    //lblArquivo.Text += arquivo;
                    try
                    {
                        pbImg.Image = new Bitmap(Ofd.OpenFile());
                        Image Imagem = Image.FromFile(arquivo);
                        pbImg.SizeMode = PictureBoxSizeMode.StretchImage;
                        pbImg.Width    = 170;
                        pbImg.Height   = 153;
                        pbImg.Image    = Imagem;
                        caminho_imagem = arquivo;
                    }
                    catch (Exception)
                    {
                    }
                }
            }
        }
Beispiel #5
0
 private bool LoadPrologue()
 {
     return(QuerySaveIfNeeded() && Ofd.ShowDialog(this) == DialogResult.OK);
 }