Example #1
0
        private void BtnOpenImage_OnClick(object sender, RoutedEventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Multiselect = true;
            open.ShowDialog();
            string[] pathes = open.FileNames;
            foreach (var path in pathes)
            {
                Image img = Image.FromFile(path);
                _ms = new MemoryStream();
                img.Save(_ms, img.RawFormat);
                CarsFoto f = new CarsFoto
                {
                    Foto = _ms.ToArray()
                };
                CarsFotos.Add(f);
            }

            Test.ItemsSource = CarsFotos;
            Test.RefreshData();
        }
Example #2
0
        private void btnSelectFotos_Click(object sender, EventArgs e)
        {
            OpenFileDialog open = new OpenFileDialog();

            open.Multiselect = true;
            open.ShowDialog();
            string [] result = open.FileNames;
            foreach (var path in result)
            {
                Image img = Image.FromFile(path);
                Ms = new MemoryStream();
                img.Save(Ms, img.RawFormat);
                CarsFoto f = new CarsFoto
                {
                    Foto = Ms.ToArray()
                };
                Foto.Add(f);
            }


            gridControl1.DataSource = Foto;
            gridControl1.Refresh();
        }