当前位置: 首页>>代码示例>>C#>>正文


C# System.Windows.Forms.OpenFileDialog.Dispose方法代码示例

本文整理汇总了C#中System.Windows.Forms.OpenFileDialog.Dispose方法的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.OpenFileDialog.Dispose方法的具体用法?C# System.Windows.Forms.OpenFileDialog.Dispose怎么用?C# System.Windows.Forms.OpenFileDialog.Dispose使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.OpenFileDialog的用法示例。


在下文中一共展示了System.Windows.Forms.OpenFileDialog.Dispose方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddImageAction

        public void AddImageAction()
        {
            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
            dlg.Filter = "Images|*.png;*.gif;*.jpg";

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string[] filePath = dlg.FileNames;
                StreamReader  sr = new StreamReader(filePath[0]);
                BinaryReader read = new BinaryReader(sr.BaseStream);
                Pict = read.ReadBytes((int)sr.BaseStream.Length);

            }
            dlg.Dispose();
        }
开发者ID:yoan-durand,项目名称:MTIHospital,代码行数:15,代码来源:Nouveau_PersonnelViewModel.cs

示例2: AddImageAction

        public void AddImageAction()
        {
            System.Windows.Forms.OpenFileDialog dlg = new System.Windows.Forms.OpenFileDialog();
            dlg.Filter = "Images|*.png;*.gif;*.jpg";

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string[] filePath = dlg.FileNames;
                StreamReader sr = new StreamReader(filePath[0]);
                BinaryReader read = new BinaryReader(sr.BaseStream);
                byte[] Pict = read.ReadBytes((int)sr.BaseStream.Length);

                MemoryStream stream = new MemoryStream(Pict);
                stream.Position = 0;
                BitmapImage bi = new BitmapImage();
                bi.BeginInit();
                bi.StreamSource = stream;
                bi.EndInit();

                ImageSource imgsrc = bi;
                Image newimg = new Image();
                newimg.Source = imgsrc;

                ObservableCollection<Image> listimage = new ObservableCollection<Image>();
                foreach (Image img in Pictures)
                {
                    listimage.Add(img);
                }

                listimage.Add(newimg);
                Pictures = listimage;
            }
            dlg.Dispose();
        }
开发者ID:yoan-durand,项目名称:MTIHospital,代码行数:34,代码来源:NewObservationViewModel.cs

示例3: MenuItem_Click_4_1

        private void MenuItem_Click_4_1(object sender, RoutedEventArgs e)
        {
            // 고객 excel로 추가
            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            openFileDialog.Multiselect = false;
            openFileDialog.Filter = "Excel 97-2013|*.xls";
            openFileDialog.FilterIndex = 1;
            openFileDialog.ShowDialog();

            string xlsfilename = openFileDialog.FileName;

            if (string.IsNullOrEmpty(xlsfilename))
                return;

            openFileDialog.Dispose();

            DataSet ds = ExcelHelper.OpenExcelDB(xlsfilename);

            if (ds != null)
            {
                if (ds.Tables.Count == 1)
                {
                    foreach (DataRow row in ds.Tables[0].Rows)
                    {
                        Customer _customer = new Customer() {
                            Group_Name = row[0].ToString().Trim(),
                            Name = row[1].ToString().Trim(),
                            Company = row[2].ToString().Trim(),
                            Title = row[3].ToString().Trim(),
                            Tel = row[4].ToString().Trim(),
                            Cellular = row[5].ToString().Trim(),
                            Extension = row[6].ToString().Trim(),
                            Email = row[7].ToString().Trim(),
                            Addr = row[8].ToString().Trim()
                        };
                        customers.importExcel(_customer);
                    }
                }
            }
        }
开发者ID:step4u,项目名称:MiniCRM,代码行数:40,代码来源:PhoneBook.xaml.cs

示例4: CustomAction3

        public static ActionResult CustomAction3(Session session)
        {
            System.Windows.Forms.OpenFileDialog openFileDialog = null;

            try
            {

                var thread = new Thread(
                    () =>
                    {

                        using (openFileDialog = new System.Windows.Forms.OpenFileDialog())
                            openFileDialog.CheckPathExists = true;
                        openFileDialog.CheckFileExists = true;
                        openFileDialog.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp;";
                        openFileDialog.DefaultExt = "*. *";

                        if (openFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        {
                            session["IMGPATH"] = openFileDialog.FileName;

                        }

                        if (openFileDialog != null)
                        {
                            openFileDialog.Dispose();
                        }
                    });
                thread.SetApartmentState(ApartmentState.STA);
                thread.Start();
                thread.Join();

            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show(ex.ToString());
            }

            return ActionResult.Success;
        }
开发者ID:FlorinFlo,项目名称:PrinchBookingSystem,代码行数:40,代码来源:CustomAction.cs

示例5: OpenProject

        /// <summary>
        /// 
        /// </summary>
        private void OpenProject()
        {
            SaveChangesOnDemand();

            System.Windows.Forms.OpenFileDialog form = new System.Windows.Forms.OpenFileDialog();
            form.Filter = "Xml files (*.xml)|*.xml";
            form.Multiselect = false;

            if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                LoadFile(form.FileName);
            }

            form.Dispose();
        }
开发者ID:xcasadio,项目名称:FlowGraph,代码行数:18,代码来源:MainWindow.xaml.cs

示例6: UploadNewAvatar

        private async void UploadNewAvatar(object sender, MouseButtonEventArgs e)
        {
            var dialog = new System.Windows.Forms.OpenFileDialog
                             {
                                 DefaultExt = ".png",
                                 InitialDirectory = Environment.SpecialFolder.MyPictures.ToString(),
                                 Title = "Select a new avatar",
                                 Filter = "Image files | *.png; *.jpg; *.bmp"
                             };
            dialog.ShowDialog();

            var mimeType = "image/";

            if (String.IsNullOrEmpty(dialog.FileName)) return;
            if (dialog.SafeFileName == null) return;

            if (dialog.SafeFileName.EndsWith(".png")) mimeType += "png";
            else if (dialog.SafeFileName.ToLower().EndsWith(".jpg")) mimeType += "jpg";
            else if (dialog.SafeFileName.EndsWith(".bmp")) mimeType += "bmp";
            else
            {
                dialog.Dispose();
                App.Connection.NotificationController.Notification.Notify("That's not a supported file type! Please try again.");
                return;
            }

            await App.Connection.SessionController.CurrentSession.UploadAvatar(
                new FileStream(dialog.FileName, FileMode.Open), mimeType);
            dialog.Dispose();
            
        }
开发者ID:Conji,项目名称:Cloudsdale-Win7,代码行数:31,代码来源:Settings.xaml.cs


注:本文中的System.Windows.Forms.OpenFileDialog.Dispose方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。