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


C# SaveFileDialog.Reset方法代码示例

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


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

示例1: Reset

		public void Reset ()
		{
			SaveFileDialog sfd = new SaveFileDialog ();
			sfd.AddExtension = false;
			sfd.CheckFileExists = true;
			sfd.CheckPathExists = false;
			sfd.CreatePrompt = true;
			sfd.DefaultExt = "txt";
			sfd.DereferenceLinks = false;
			sfd.FileName = "default.build";
			sfd.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
			sfd.FilterIndex = 5;
			sfd.InitialDirectory = Path.GetTempPath ();
			sfd.OverwritePrompt = false;
			sfd.RestoreDirectory = true;
			sfd.ShowHelp = true;
			sfd.Title = "Saving";
			sfd.ValidateNames = false;
			sfd.Reset ();

			Assert.IsTrue (sfd.AddExtension, "#1");
			Assert.IsFalse (sfd.CheckFileExists, "#2");
			Assert.IsTrue (sfd.CheckPathExists, "#3");
			Assert.IsFalse (sfd.CreatePrompt, "#4");
			Assert.IsNotNull (sfd.DefaultExt, "#5");
			Assert.AreEqual (string.Empty, sfd.DefaultExt, "#6");
			Assert.IsTrue (sfd.DereferenceLinks, "#7");
			Assert.IsNotNull (sfd.FileName, "#8");
			Assert.AreEqual (string.Empty, sfd.FileName, "#9");
			Assert.IsNotNull (sfd.FileNames, "#10");
			Assert.AreEqual (0, sfd.FileNames.Length, "#11");
			Assert.IsNotNull (sfd.Filter, "#12");
			Assert.AreEqual (string.Empty, sfd.Filter, "#13");
			Assert.AreEqual (1, sfd.FilterIndex, "#14");
			Assert.IsNotNull (sfd.InitialDirectory, "#15");
			Assert.AreEqual (string.Empty, sfd.InitialDirectory, "#16");
			Assert.IsTrue (sfd.OverwritePrompt, "#17");
			Assert.IsFalse (sfd.RestoreDirectory, "#18");
			Assert.IsFalse (sfd.ShowHelp, "#19");
			Assert.IsNotNull (sfd.Title, "#20");
			Assert.AreEqual (string.Empty, sfd.Title, "#21");
			Assert.IsTrue (sfd.ValidateNames, "#22");
		}
开发者ID:KonajuGames,项目名称:SharpLang,代码行数:43,代码来源:SaveFileDialogTest.cs

示例2: SaveButton_Click

 private void SaveButton_Click( object sender, EventArgs e )
 {
     if (_saveFileDialogOpened) return;
     _saveFileDialogOpened = true;
     _saveFileDialog = new SaveFileDialog();
     _saveFileDialog.Reset();
     _saveFileDialog.DefaultExt = ".xml";
     _saveFileDialog.InitialDirectory = _defaultFolder;
     _saveFileDialog.Filter = "XML files(*.xml)|*.xml|config files(*.config)|*.config";
     _saveFileDialog.FilterIndex = 1;
     _saveFileDialog.Title = "Save Custom Bedlam Config File...";
     DialogResult result = _saveFileDialog.ShowDialog();
     if(result == DialogResult.OK) 
     {
         string fileName = _saveFileDialog.FileName;
         SaveBedlamConfigValues(fileName);
     }
     _saveFileDialogOpened = false;
 }
开发者ID:GitTorre,项目名称:Bedlam,代码行数:19,代码来源:Form1.cs

示例3: cmdBrowse_Click

        private void cmdBrowse_Click(object sender, EventArgs e)
        {
            // Show the save box
            if (lvTemplates.SelectedItems.Count == 0) {
                MessageBox.Show("Please select a template to use before setting the file to save.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            string fileExtension = Path.GetExtension(lvTemplates.SelectedItems[0].Tag.ToString().Split('|')[1]);

            Directory.SetCurrentDirectory(g.Project.ProjectPath);
            SaveFileDialog sfd = new SaveFileDialog();
            sfd.RestoreDirectory = true;
            sfd.Title = "Add New Item";
            sfd.Filter = "*" + fileExtension + " Files|*" + fileExtension + "|All Files (*.*)|*.*";
            sfd.OverwritePrompt = true;
            sfd.CheckPathExists = true;

            DialogResult result = sfd.ShowDialog(this);

            if (result == DialogResult.Cancel)
                return;

            txtSaveTo.Text = sfd.FileName;
            sfd.Reset();
        }
开发者ID:Bloodknight,项目名称:TorqueDev,代码行数:26,代码来源:frmNewItem.cs


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