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


C# SaveFileDialog.Dispose方法代码示例

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


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

示例1: buttonSalvar_Click

        private void buttonSalvar_Click(object sender, EventArgs e)
        {
            //Salva os arquivos gerados para relatorio
            SaveFileDialog SFD = new SaveFileDialog();

            //Extensões possíveis de salvar o relatório
            SFD.Filter = "Texto|*.txt|Word|*.doc|planilha|*.ods|html|*.html|PDF|*.pdf|Todos os Arquivos|*.*";
            SFD.FilterIndex = 2;
            SFD.FileName = "Historico1";
            if (SFD.ShowDialog() == DialogResult.OK)
            {
                FileStream fs = new FileStream(SFD.FileName, FileMode.Create);
                StreamWriter writer = new StreamWriter(fs);
                writer.WriteLine("\tHistorico");
                writer.WriteLine();
                int i = 0;
                while (i < listViewHistorico.Items.Count)
                {
                    //salva os dados que estão no listview
                    writer.Write(listViewHistorico.Items[i].Text + " - ");
                    writer.Write(listViewHistorico.Items[i].SubItems[1].Text + " - ");
                    writer.Write(listViewHistorico.Items[i].SubItems[2].Text + " - ");
                    writer.Write(listViewHistorico.Items[i].SubItems[3].Text + " - ");
                    writer.Write(listViewHistorico.Items[i].SubItems[4].Text);
                    writer.WriteLine();
                    writer.WriteLine();
                    i++;
                }
                writer.Close();
                SFD.Dispose();
            }
        }
开发者ID:AndreiPedroWiliam,项目名称:ProjetoFinalPJS,代码行数:32,代码来源:FormHistorico.cs

示例2: btn_guardar_Click

        private void btn_guardar_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog1;
            saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.Title = "Guardar Archivo de Texto";
            saveFileDialog1.Filter = "Archivo de Texto (.txt) |*.txt";

            saveFileDialog1.DefaultExt = "txt";
            saveFileDialog1.AddExtension = true;
            saveFileDialog1.RestoreDirectory = true;
            saveFileDialog1.InitialDirectory = @"H:\LO DEL ESCRITORIO";

            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string ruta = saveFileDialog1.FileName;

                StreamWriter fichero = new StreamWriter(ruta);
                fichero.Write(txt_error.Text);
                fichero.Close();

            }
            else
            {

            }
            saveFileDialog1.Dispose();
            saveFileDialog1 = null;
        }
开发者ID:EstebanLL,项目名称:Sistema_de_Ventas,代码行数:28,代码来源:Ventana_Error.cs

示例3: Execute

        public void Execute(IMenuCommand command)
        {
            var dslDiagram = DiagramContext.CurrentDiagram.GetObject<Diagram>();

            if (dslDiagram == null)
                return;

            var dialog = new SaveFileDialog
                             {
                                 AddExtension = true,
                                 DefaultExt = "image.bmp",
                                 Filter = "Bitmap ( *.bmp )|*.bmp|JPEG File ( *.jpg )|*.jpg|Enhanced Metafile (*.emf )|*.emf|Portable Network Graphic ( *.png )|*.png",
                                 FilterIndex = 1,
                                 Title = "Save Diagram to Image"
                             };

            if (dialog.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(dialog.FileName))
            {
                var bitmap = dslDiagram.CreateBitmap(dslDiagram.NestedChildShapes, Diagram.CreateBitmapPreference.FavorClarityOverSmallSize);
                bitmap.Save(dialog.FileName, GetImageType(dialog.FilterIndex));
                bitmap.Dispose();
            }

            dialog.Dispose();
        }
开发者ID:Wangweizhou,项目名称:Visual-Studio-Experiments,代码行数:25,代码来源:Command.cs

示例4: Run

		public override void Run()
		{
			ResourceEditorControl editor = ((ResourceEditWrapper)SD.Workbench.ActiveViewContent).ResourceEditor;
			ResourceList list = editor.ResourceList;
			
			if(list.SelectedItems.Count != 1) {
				return;
			}
			
			string key = list.SelectedItems[0].Text;
			if(! list.Resources.ContainsKey(key)) {
				return;
			}
			
			ResourceItem item = list.Resources[key];
			SaveFileDialog sdialog 	= new SaveFileDialog();
			sdialog.AddExtension = true;
			sdialog.FileName = key;
			
			if (item.ResourceValue is Bitmap) {
				sdialog.Filter 		= StringParser.Parse("${res:SharpDevelop.FileFilter.ImageFiles} (*.png)|*.png");
				sdialog.DefaultExt 	= ".png";
			} else if (item.ResourceValue is Icon) {
				sdialog.Filter 		= StringParser.Parse("${res:SharpDevelop.FileFilter.Icons}|*.ico");
				sdialog.DefaultExt 	= ".ico";
			} else if (item.ResourceValue is Cursor) {
				sdialog.Filter 		= StringParser.Parse("${res:SharpDevelop.FileFilter.CursorFiles} (*.cur)|*.cur");
				sdialog.DefaultExt 	= ".cur";
			} else if (item.ResourceValue is byte[]){
				sdialog.Filter      = StringParser.Parse("${res:SharpDevelop.FileFilter.BinaryFiles} (*.*)|*.*");
				sdialog.DefaultExt  = ".bin";
			} else {
				return;
			}
			
			DialogResult dr = sdialog.ShowDialog(SD.WinForms.MainWin32Window);
			sdialog.Dispose();
			if (dr != DialogResult.OK) {
				return;
			}
			
			try {
				if (item.ResourceValue is Icon) {
					FileStream fstr = new FileStream(sdialog.FileName, FileMode.Create);
					((Icon)item.ResourceValue).Save(fstr);
					fstr.Close();
				} else if(item.ResourceValue is Image) {
					Image img = (Image)item.ResourceValue;
					img.Save(sdialog.FileName);
				} else {
					FileStream fstr = new FileStream(sdialog.FileName, FileMode.Create);
					BinaryWriter wr = new BinaryWriter(fstr);
					wr.Write((byte[])item.ResourceValue);
					fstr.Close();
				}
			} catch(Exception ex) {
				MessageBox.Show(ex.Message, "Can't save resource to " + sdialog.FileName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
			}
		}
开发者ID:Paccc,项目名称:SharpDevelop,代码行数:59,代码来源:SaveEntryAsCommand.cs

示例5: saveBitmapAs

 public void saveBitmapAs(MyBitmap myBitmap)
 {
     if (myBitmap != null)
     {
         SaveFileDialog saveDialog = new SaveFileDialog();
         saveDialog.FileName = "moj_plik";
         saveDialog.Filter = "Plik graficzny (*.bmp)|*.BMP; *.bmp";
         saveDialog.ShowDialog();
         myBitmap.CurrentBitmap.Save(saveDialog.FileName);
         saveDialog.Dispose();
     }
 }
开发者ID:radol91,项目名称:BitMapEditorSolution,代码行数:12,代码来源:BitmapManager.cs

示例6: btnCSV_Click

 private void btnCSV_Click(object sender, EventArgs e)
 {
     SaveFileDialog sFd = new SaveFileDialog();
     sFd.DefaultExt = ".csv";
     sFd.Filter = "Text|*.csv";
     sFd.Title = "Save CSV to";
     sFd.AddExtension = true;
     if (sFd.ShowDialog(this) == DialogResult.OK)
     {
         txtCSV.Text = sFd.FileName;
     }
     sFd.Dispose();
 }
开发者ID:GeospatialDaryl,项目名称:USFS_RMRS_FunctionalModeling_RasterModeling,代码行数:13,代码来源:frmExportSampleToCsv.cs

示例7: button1_Click

 private void button1_Click(object sender, EventArgs e)
 {
     SaveFileDialog saveFileDialog = new SaveFileDialog();
     saveFileDialog.CheckPathExists = true;
     saveFileDialog.OverwritePrompt = true;
     saveFileDialog.RestoreDirectory = true;
     saveFileDialog.Filter = "Shapefile(*.shp)|*.shp";
     saveFileDialog.Title = "输出图层位置";
     saveFileDialog.ShowDialog();
     saveFileDialog.Dispose();
     textBoxLocation.Text = saveFileDialog.FileName;
     strFullPath = saveFileDialog.FileName;
 }
开发者ID:hijushen,项目名称:WindowDemo,代码行数:13,代码来源:frmCreateNewLayer.cs

示例8: SaveFileDialogBox

        /// <summary>
        /// Creates a Save File Dialog box with default name and filters applied. Automatically adds correct file extension to returned path.
        /// </summary>
        /// <param name="fileExtension">The file extension to filter for and apply.</param>
        /// <param name="typeName">The full name description of the file type.</param>
        /// <param name="defaultFileName">Default save name for the file.</param>
        /// <param name="initialDirectory">The initial directory to open to.</param>
        /// <returns>The full String path of the file save location, with file extension, or null on Cancel.</returns>
        public static String SaveFileDialogBox(String fileExtension, String typeName, String defaultFileName, String initialDirectory)
        {
            // This little function is here because for some reason AddExtension = false doesn't seem to do shit.
            // So basically I just check it manually.

            SaveFileDialog saveFileDialog = new SaveFileDialog
            {
                AddExtension = false,
                DefaultExt = fileExtension,
                FileName = defaultFileName,
                Filter = String.Format("{1} File(s) (*.{0})|*.{0}", fileExtension, typeName),
                InitialDirectory = initialDirectory
            };

            if (saveFileDialog.ShowDialog() != DialogResult.OK)
            {
                saveFileDialog.Dispose();
                return null;
            }
            String filePath = saveFileDialog.FileName;
            saveFileDialog.Dispose();

            // since AddExtension = false doesn't seem to do shit
            string replaceExtension = "." + fileExtension;
            while (filePath.Contains(replaceExtension))
            {
                filePath = filePath.Replace(replaceExtension, "");
            }
            filePath += replaceExtension;

            if (!filePath.Contains(fileExtension))
            {
                filePath += fileExtension;
            }

            return filePath;
        }
开发者ID:khadoran,项目名称:reanimator,代码行数:45,代码来源:FormTools.cs

示例9: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            SaveFileDialog sfd = new SaveFileDialog();

            ofd.Multiselect = true;
            var oResult= ofd.ShowDialog();
            if (oResult==DialogResult.OK)
            {
                var files = ofd.FileNames;
                var temp1 = files.ToList();
                temp1.Sort();
                files = temp1.ToArray();

                Bitmap[] bitmaps = new Bitmap[files.Length];

                for (int i = 0; i < files.Length; i++)
                {
                    bitmaps[i] = new Bitmap(files[i]);
                }

                Bitmap output = new Bitmap(bitmaps[0].Width, bitmaps.Select(temp=>temp.Height).Sum());

                int yy = 0;

                for (int i = 0; i < bitmaps.Length; i++)
                {
                    for (int y = 0; y < bitmaps[i].Height; y++)
                    {
                        for (int x = 0; x < bitmaps[i].Width; x++)
                        {
                            var c = bitmaps[i].GetPixel(x, y);

                            output.SetPixel(x,yy, c);
                        }

                        yy++;
                    }
                }

                if (sfd.ShowDialog() == DialogResult.OK)
                {
                    output.Save(sfd.FileName, ImageFormat.Jpeg);
                }
            }

            sfd.Dispose();
            ofd.Dispose();
        }
开发者ID:h82258652,项目名称:MyImageMerge,代码行数:49,代码来源:Form1.cs

示例10: Export

 public void Export(object sender, EventArgs e)
 {
     String expfilter = StringValue.ExportFormats;
     SaveFileDialog dlgExport = new SaveFileDialog();
     dlgExport.Filter = expfilter;
     dlgExport.CheckFileExists = false;
     dlgExport.CheckPathExists = true;
     dlgExport.Title = "Export As...";
     if (dlgExport.ShowDialog() == DialogResult.OK)
     {
         ExportObject((EnumValues.FilterType)dlgExport.FilterIndex, dlgExport.FileName);
     }
     dlgExport.Dispose();
     dlgExport = null;
 }
开发者ID:johnjohnsp1,项目名称:PoshSecFramework,代码行数:15,代码来源:PSObjectGrid.cs

示例11: Export

 public void Export(object sender, EventArgs e)
 {
     String expfilter = "Extensible Markup Language (*.xml)|*.xml|Comma Separate Values (*.csv)|*.csv|Tabbed Delimited (*.txt)|*.txt";
     SaveFileDialog dlgExport = new SaveFileDialog();
     dlgExport.Filter = expfilter;
     dlgExport.CheckFileExists = false;
     dlgExport.CheckPathExists = true;
     dlgExport.Title = "Export As...";
     if (dlgExport.ShowDialog() == DialogResult.OK)
     {
         ExportObject((FilterType)dlgExport.FilterIndex, dlgExport.FileName);
     }
     dlgExport.Dispose();
     dlgExport = null;
 }
开发者ID:routeback,项目名称:PoshSecFramework,代码行数:15,代码来源:PSObjectGrid.cs

示例12: Run

 public override void Run()
 {
     TempletPrintNode owner = (TempletPrintNode) this.Owner;
     if (owner != null)
     {
         TempletPrint domainObject = owner.DomainObject;
         SaveFileDialog dialog = new SaveFileDialog();
         dialog.FileName = domainObject.TempletFile;
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             File.WriteAllBytes(dialog.FileName, domainObject.Data);
         }
         dialog.Dispose();
     }
 }
开发者ID:vanloc0301,项目名称:mychongchong,代码行数:15,代码来源:SaveAsTempletCommand.cs

示例13: ShowSaveDialog

 public static bool ShowSaveDialog(out string path)
 {
     path = null;
     var result = false;
     var saver = new SaveFileDialog
     {
         AddExtension = true,
         AutoUpgradeEnabled = true,
         DefaultExt = "pcdb",
         Filter = fileNameFilter
     };
     if (saver.ShowDialog() == DialogResult.OK)
     {
         path = saver.FileName;
         result = true;
     }
     saver.Dispose();
     return result;
 }
开发者ID:nitrocaster,项目名称:ListPlayers,代码行数:19,代码来源:PcdbFileDialog.cs

示例14: btnExport_Click

        private void btnExport_Click(object sender, EventArgs e)
        {
            SaveFileDialog saveFileDialog1 = new SaveFileDialog();
            saveFileDialog1.RestoreDirectory = true;
            Application.DoEvents();
            try
            {
                string strFilter = "Excel�ļ�(*.xls)|*.xls";
                if (xtraTabControl1.SelectedTabPageIndex == 0)
                {
                    ExportXls();
                }
                else
                {
                    strFilter = "ͼƬ�ļ�(*.jpeg)|*.jpeg";
                    saveFileDialog1.Filter = strFilter;
                    if (saveFileDialog1.ShowDialog() == DialogResult.OK)
                    {
                        this.Cursor = Cursors.WaitCursor;
                        try
                        {
                            chartControl1.ExportToImage(saveFileDialog1.FileName, ImageFormat.Jpeg);
                            XtraMessageBox.Show("����ͼƬ�ɹ�!", "��ʾ", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        }
                        catch (Exception ex)
                        {
                            XtraMessageBox.Show("����ͼƬʧ��!", "����", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                        saveFileDialog1.FileName = "";
                        saveFileDialog1.Dispose();
                    }
                }
            }
            catch
            {

            }
            finally
            {
                this.Cursor = Cursors.Default;
            }
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:42,代码来源:frmAppraise.cs

示例15: button1_Click

        private void button1_Click(object sender, EventArgs e)
        {
            string path = "";
            string text = "";
            string[] textArray;

            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "Text File|*.txt";
            if (sfd.ShowDialog() == DialogResult.OK)
            {
                path = sfd.FileName;
                sfd.Dispose();
            }
            StreamWriter sw = new StreamWriter(File.Create(path));
            sw.WriteLine(textBox1.Text + ":" + textBox4.Text + ":" + textBox2.Text + ":" + textBox3.Text + ":");
            sw.Dispose();

            StreamReader sr = new StreamReader(File.OpenRead(path));
            text = sr.ReadLine();
            textArray = text.Split(':');
        }
开发者ID:BrandonLaRue,项目名称:FirstPrograms,代码行数:21,代码来源:Form1.cs


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