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


C# OpenFileDialog.Dispose方法代码示例

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


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

示例1: addImagesToolStripMenuItem_Click

 private void addImagesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog FileOpen = new OpenFileDialog();
     FileOpen.Title = "Open Image File";
     FileOpen.Multiselect = true;
     FileOpen.Filter = "All (*.*)|*.*|JPEG (*.jpg)|*.jpg|Bitmap (*.bmp)|*.bmp|TIFF (*.tiff)|*.tiff";
     DialogResult Result = FileOpen.ShowDialog();
     if (Result == DialogResult.OK)
     {
         foreach (String img in FileOpen.FileNames)
         {
             PictureBox p = new PictureBox();
             p.Image = Image.FromFile(img);
             if (images.Count > 0)
             {
                 if (p.Image.Height != images[0].Image.Height
                  || p.Image.Width != images[0].Image.Width)
                 {
                     MessageBox.Show(img + " posiada inne wymiary niz pierwszy wczytany obraz!");
                     FileOpen.Dispose();
                     UpdateImages();
                     return;
                 }
             }
             images.Add(p);
             p.Click += previevImageClick;
             p.SizeMode = PictureBoxSizeMode.Zoom;
         }
         UpdateImages();
     }
     else FileOpen.Dispose();
 }
开发者ID:quavepl,项目名称:APOBlabs,代码行数:32,代码来源:ColorAndMovement.cs

示例2: OpenFile

 /// <summary>
 /// Open a new file. Will ask for the file name in a dialog.
 /// </summary>
 public void OpenFile()
 {
     OpenFileDialog dlg = new OpenFileDialog ();
     if (dlg.ShowDialog () == DialogResult.OK)
         OpenFile (dlg.FileName);
     dlg.Dispose ();
 }
开发者ID:NALSS,项目名称:Telegraph,代码行数:10,代码来源:TextEditor.cs

示例3: openToolStripMenuItem_Click

        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // Create a dialog to ask the user for the full path of a file.
            OpenFileDialog dlg = new OpenFileDialog();

            // Initialize the dialog with some values before displaying it.
            dlg.Title = "Open File";
            dlg.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
            dlg.InitialDirectory =
                        Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            // Display the dialog.
            if (dlg.ShowDialog() == DialogResult.OK && dlg.FileName != string.Empty)
            {
                try
                {
                    // Open and display the file.
                    StreamReader reader = new StreamReader(dlg.FileName);
                    textBoxDocument.Text = reader.ReadToEnd();
                    reader.Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
            }

            dlg.Dispose();
        }
开发者ID:dennex,项目名称:Comp2614,代码行数:30,代码来源:MainForm.cs

示例4: OnClickBrowse

 private void OnClickBrowse(object sender, EventArgs e)
 {
     OpenFileDialog dialog = new OpenFileDialog();
     dialog.Multiselect = false;
     string type = "txt";
     switch (comboBox1.SelectedIndex)
     {
         case 0: type = "txt";
             break;
         case 1: type = "uoa";
             break;
         case 2: type = "uoab";
             break;
         case 3: type = "wsc";
             break;
     }
     dialog.Title = String.Format("Choose {0} file to import", type);
     dialog.CheckFileExists = true;
     if (type == "uoab")
         dialog.Filter = "{0} file (*.uoa)|*.uoa";
     else
         dialog.Filter = String.Format("{0} file (*.{0})|*.{0}", type);
     if (dialog.ShowDialog() == DialogResult.OK)
         textBox1.Text = dialog.FileName;
     dialog.Dispose();
 }
开发者ID:greeduomacro,项目名称:FiddlerPlugin,代码行数:26,代码来源:MultiImport.cs

示例5: mnuOpen_OnClick

 void mnuOpen_OnClick(object sender, EventArgs e)
 {
     var dlg = new OpenFileDialog {InitialDirectory = "C:\\", Filter = @"CSV|*.csv"};
     dlg.ShowDialog(this);
     OpenFile(dlg.FileName);
     dlg.Dispose();
 }
开发者ID:daxfohl,项目名称:SudokuCS,代码行数:7,代码来源:Form1.cs

示例6: button3_Click

        private void button3_Click(object sender, EventArgs e)
        {
            DbWorker dbWorker;
            OpenFileDialog ofdOpen = new OpenFileDialog();
           
                if (ofdOpen.ShowDialog() != DialogResult.OK)
                    return;
                dbWorker = new DbWorker("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + ofdOpen.FileName);
                ofdOpen.Dispose();  
            
            try
            {
                dbWorker.OpenDB();
            }
            catch (TypeInitializationException error)
            {
                MessageBox.Show(error.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }


            dbWorker.WriteLessonsDb(tableProcessor.ListLessons,1);
            dbWorker.CloseDB();
        
  
        }
开发者ID:PAlAl,项目名称:ImportMStoDB,代码行数:25,代码来源:Form1.cs

示例7: AbrirGuardarImg

        public string AbrirGuardarImg(string LlaveImg, PictureBox Contenedor, string Ruta)
        {
            if (!(Contenedor.Image == null)) Contenedor.Image.Dispose();

            String Archivo = "";
            string NombreArchivo = "";

            var fdAttach = new OpenFileDialog();
            fdAttach.Filter = "Imagen|*.jpg;*.jpeg;*.gif;*.png;*.bmp;";
            //fdAttach.Filter = "Tipos de archivo|*.doc?;*.xls?;*.ppt?;*.pps?;*.pdf;*.txt;*.jpg;*.jpeg;*.gif;*.png;*.bmp;";
            fdAttach.Title = "Ruta del archivo a importar";
            if (fdAttach.ShowDialog() == DialogResult.OK)
                //if (fdAttach.ShowDialog(Principal.Instance) == DialogResult.OK)
                Archivo = fdAttach.FileName;
            fdAttach.Dispose();

            if (Archivo != "")
            {
                Bitmap Img;
                // string Ruta = RutaGlobal; //GlobalClass.ConfiguracionGlobal.pathImagenes;
                Ruta = Ruta + "\\(" + LlaveImg + ").jpg";
                var Cuadro = new System.Drawing.Size(130, 100);
                Img = (Bitmap)resizeImage(Image.FromFile(Archivo, true), Cuadro);
                saveJpeg(Ruta, Img, 150);
                NombreArchivo = fdAttach.FileName;
                NombreArchivo = NombreArchivo.Substring(NombreArchivo.LastIndexOf("\\") + 1).ToLower();
            }

            return NombreArchivo;
        }
开发者ID:moisesiq,项目名称:aupaga,代码行数:30,代码来源:ControlPicture.cs

示例8: buttonImport_Click

        private void buttonImport_Click(object sender, EventArgs e)
        {
            Equipment temp = new Equipment(equipment);
            try
            {
                OpenFileDialog ofd = new OpenFileDialog();
                ofd.Filter = "EquipmentFile (*.eqp)|*.eqp|All files (*.*)|*.*";
                ofd.FilterIndex = 1;

                if (ofd.ShowDialog() != DialogResult.OK)
                {
                    ofd.Dispose();
                    return;
                }

                byte[] fileData = File.ReadAllBytes(ofd.FileName);
                if (fileData.Length != Constants.SIZEOF_EQUIPMENT)
                {
                    MessageBox.Show("Invalid Equipment", "Error");
                    return;
                }

                this.equipment.EquipmentBytes = fileData;
                loadData();

                ofd.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Loading Error");
                this.equipment = temp;
            }
        }
开发者ID:yiyangpan,项目名称:APMMHXSaveEditor,代码行数:33,代码来源:EquipmentEditDialog.cs

示例9: btnLoadImage_Click

        private void btnLoadImage_Click(object sender, EventArgs e)
        {
            btnLoadImage.Enabled = false;
            
            OpenFileDialog dlg = new OpenFileDialog();
            _WhitePix = 0;
            _NonWhitePix = 0;

            dlg.Title = "Open Image";
            dlg.Filter = "JPG|*.jpg;*.jpeg|PNG|*.png|"
       + "All Graphics Types|*.jpg;*.jpeg;*.png;";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                _imagePath = dlg.FileName;
                imgSource.Image = Image.FromFile(dlg.FileName);
            }
            dlg.Dispose();

            DataTable dt = new DataTable();
            dt.Clear();
            dt.Columns.Add("Image_Source");
            dt.Rows.Add(new object []{_imagePath});
            GenerateSummary(dt, false);
            btnLoadImage.Enabled = true;
        }
开发者ID:virendra-velingkar,项目名称:imagevalidation,代码行数:25,代码来源:frmImageProcessing.cs

示例10: button2_Click

 private void button2_Click(object sender, EventArgs e)
 {
     OpenFileDialog openfile = new OpenFileDialog();
     if (openfile.ShowDialog() == DialogResult.OK && (openfile.FileName != ""))
     {
         pictureBox1.ImageLocation = openfile.FileName;
         openfile.Dispose();
     }
 }
开发者ID:IrisLinSQ,项目名称:007,代码行数:9,代码来源:ScreensAdd.cs

示例11: loadITI

 public ITI loadITI()
 {
     OpenFileDialog OFD = new OpenFileDialog();
     OFD.Filter = "ITI|*.iti";
     OFD.ShowDialog();
     string bon = OFD.FileName;
     OFD.Dispose();
     return new ITI(bon);
 }
开发者ID:tfwio,项目名称:modest-smf-vstnet,代码行数:9,代码来源:ImpulseTrackerInstrumentDemoForm.cs

示例12: button1_Click

 private void button1_Click(object sender, EventArgs e)
 {
     OpenFileDialog ofd = new OpenFileDialog();
     ofd.Filter = "Application|*.exe";
     ofd.FilterIndex = 0;
     if (ofd.ShowDialog() == DialogResult.OK)
         txtApp.Text = ofd.FileName;
     ofd.Dispose();
 }
开发者ID:andrejpanic,项目名称:win-mobile-code,代码行数:9,代码来源:AddNotification.cs

示例13: buttonBrowseBgImage_Click

 private void buttonBrowseBgImage_Click(object sender, EventArgs e)
 {
     OpenFileDialog fd = new OpenFileDialog();
     if (fd.ShowDialog() == DialogResult.OK)
     {
         textBoxBgImage.Text = fd.FileName;
     }
     fd.Dispose();
 }
开发者ID:RiskyKen,项目名称:tray-usage,代码行数:9,代码来源:frmRenderOptionsImage.cs

示例14: Parse

        public static bool Parse()
        {
            if (Program.CommandLineFile == null)
            {
                // Before we try to parse, let's make sure CurrentList is in the Keywords
                // Dict. Someone could have deleted it in the editor!
                if (Program.Keys.KeywordDict.ContainsKey(Program.Keys.CurrentList) == false)
                {
                    MessageBox.Show("You must have deleted the Keyword List you was using in the editor! Please Refresh and try again.");
                    return false;
                }

                OpenFileDialog dialog = new OpenFileDialog();
                dialog.AddExtension = true;
                dialog.Filter = "Log files (*.log)|*.log|All files (*.*)|*.*";
                dialog.InitialDirectory = Program.opt.DefaultLogPath.ToString();
                if (dialog.ShowDialog() != DialogResult.OK)
                {
                    MessageBox.Show("Error Reading Log File or no Log File Selected!");
                    return false;
                }
                Program.CommandLineFile = dialog.FileName.ToString();
                dialog.Dispose();
            }

            StreamReader LogFile = File.OpenText(Program.CommandLineFile);
            LogParsed = Program.CommandLineFile;

            // LogLine is the text line read in
            // We use a StringBuilder here to build the output for the text window.
            string LogLine = "";

            // Let's reset these so they are clean! :)
            Results.Clear();

            while ((LogLine = LogFile.ReadLine()) != null)
            {
                foreach (string TheKeyword in Program.Keys.KeywordDict[Program.Keys.CurrentList])
                {
                    string NewLogLine = LogLine;
                    string NewKeyword = TheKeyword;
                    if (Program.opt.CaseParse)
                    {
                        NewLogLine = LogLine.ToLower();
                        NewKeyword = TheKeyword.ToLower();
                    }

                    if (NewLogLine.IndexOf(NewKeyword) != -1)
                    {
                        // We found a match!
                        AddMatch(TheKeyword, LogLine.ToString());
                    }
                }
            }
            LogFile.Close();
            return true;
        }
开发者ID:polserver,项目名称:poltools,代码行数:57,代码来源:LogParser.cs

示例15: btnBuscarCsv_Click

 private void btnBuscarCsv_Click(object sender, EventArgs e)
 {
     var frmCsv = new OpenFileDialog();
     frmCsv.Filter = "(*.csv)|*.csv";
     frmCsv.Title = "Ruta del archivo Csv a importar";
     if (frmCsv.ShowDialog(Principal.Instance) == DialogResult.OK)
         this.txtRutaCsv.Text = frmCsv.FileName;
     frmCsv.Dispose();
 }
开发者ID:moisesiq,项目名称:aupaga,代码行数:9,代码来源:PartesImportar.cs


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