本文整理汇总了C#中System.Windows.Forms.SaveFileDialog类的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.SaveFileDialog类的具体用法?C# System.Windows.Forms.SaveFileDialog怎么用?C# System.Windows.Forms.SaveFileDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Windows.Forms.SaveFileDialog类属于命名空间,在下文中一共展示了System.Windows.Forms.SaveFileDialog类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: OnClick
protected override void OnClick()
{
if (IsExportMode)
{
var saveFile = new System.Windows.Forms.SaveFileDialog();
saveFile.AddExtension = true;
saveFile.AutoUpgradeEnabled = true;
saveFile.CheckPathExists = true;
saveFile.DefaultExt = ExportModeDefaultExtension;
saveFile.Filter = ExportModeExtensionFilter;
saveFile.FilterIndex = 0;
var result = saveFile.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
{
var fileName = saveFile.FileName;
this.CommandParameter = fileName;
base.OnClick();
}
}
else
{
base.OnClick();
}
}
开发者ID:iLuffy,项目名称:ILuffy,代码行数:25,代码来源:ImageButton.xaml.cs
示例2: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(CaptureForm));
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.SuspendLayout();
//
// CaptureForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(192)))));
this.ClientSize = new System.Drawing.Size(604, 384);
this.ControlBox = false;
this.Cursor = System.Windows.Forms.Cursors.Cross;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "CaptureForm";
this.Opacity = 0.3;
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.Text = "Form1";
this.TopMost = true;
this.TransparencyKey = System.Drawing.Color.White;
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ResumeLayout(false);
}
开发者ID:deepblue,项目名称:clipnote,代码行数:30,代码来源:CaptureForm.designer.cs
示例3: DoAction
private void DoAction(Mine2D game, int buttonNumber)
{
switch (buttonNumber)
{
case 0:
game.gameState = GameState.Playing;
break;
case 1:
System.Windows.Forms.SaveFileDialog saveWorld = new System.Windows.Forms.SaveFileDialog();
saveWorld.Filter = "Сжатые миры Mine2D|*.m2d";
if (saveWorld.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
game.gameState = GameState.SavingWorld;
new System.Threading.Thread(delegate()
{
LevelManager.SaveLevel(game, saveWorld.FileName);
}).Start();
}
break;
case 2:
LevelManager.RecreateLevel(game);
game.gameState = GameState.MainMenu;
break;
}
}
开发者ID:ArtSin,项目名称:Mine2D-Old,代码行数:27,代码来源:PauseMenu.cs
示例4: SelectFile
/// <summary>
/// Return true is user selects and confirms
/// output file name and folder.
/// </summary>
static bool SelectFile(
ref string folder_path,
ref string filename)
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.Title = "JSelect SON Output File";
dlg.Filter = "JSON files|*.js";
if( null != folder_path
&& 0 < folder_path.Length )
{
dlg.InitialDirectory = folder_path;
}
dlg.FileName = filename;
bool rc = DialogResult.OK == dlg.ShowDialog();
if( rc )
{
filename = Path.GetFileName( dlg.FileName );
folder_path = Path.GetDirectoryName(
filename );
}
return rc;
}
开发者ID:khoaho,项目名称:RvtVa3c,代码行数:32,代码来源:Command.cs
示例5: _export_Click
private void _export_Click(object sender, RoutedEventArgs e)
{
//打开对话框
System.Windows.Forms.SaveFileDialog saveFile = new System.Windows.Forms.SaveFileDialog();
saveFile.Filter = "JPG(*.jpg)|*.jpg";
saveFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
if (saveFile.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
{
return;
}
var saveFilePath = saveFile.FileName;
if (saveFilePath != "")
{
if (web != null)
{
if (web.ReadyState == System.Windows.Forms.WebBrowserReadyState.Complete)
{
System.Drawing.Rectangle r = web.Document.Body.ScrollRectangle;
web.Height = r.Height;
web.Width = r.Width;
Bitmap bitMapPic = new Bitmap(r.Width, r.Height);
web.DrawToBitmap(bitMapPic, r);
bitMapPic.Save(saveFilePath);
Toolkit.MessageBox.Show("文件导出成功!", "系统提示", MessageBoxButton.OK, MessageBoxImage.Information);
}
}
}
}
开发者ID:wuqiangqiang,项目名称:dcs,代码行数:28,代码来源:SysQuarterAnalysis.xaml.cs
示例6: btnAddData_Click
private void btnAddData_Click(object sender, EventArgs e)
{
/////////////////////////////////
//Replace with something that uses the default data provider
System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
sfd.OverwritePrompt = true;
sfd.Filter = "Shape Files|*.shp";
if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
IFeatureSet _addedFeatureSet = new MapWindow.Data.Shapefile();
_addedFeatureSet.Filename = sfd.FileName;
//If the features set is null do nothing the user probably hit cancel
if (_addedFeatureSet == null)
return;
//If the feature type is good save it
else
{
//This inserts the new featureset into the list
textBox1.Text = System.IO.Path.GetFileNameWithoutExtension(_addedFeatureSet.Filename);
base.Param.Value = _addedFeatureSet;
base.Status = ToolStatus.Ok;
base.LightTipText = MapWindow.MessageStrings.FeaturesetValid;
}
}
}
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:27,代码来源:FeatureSetElementOut.cs
示例7: saveBtn_Click
private void saveBtn_Click(object sender, RoutedEventArgs e)
{
System.Windows.Forms.SaveFileDialog save = new System.Windows.Forms.SaveFileDialog();
save.DefaultExt = "txt";
save.Filter = Strings.GetLabelString("TxtFileDescriptionPlural")+"|*.txt|"+ Strings.GetLabelString("AllFileDescriptionPlural") +"|*";
save.Title = Strings.GetLabelString("SaveReportQuestion");
if (AAnalyzer.LastSavePath == null)
save.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
else
save.InitialDirectory = AAnalyzer.LastSavePath;
save.FileName = analyzer.game.Name + ".txt";
if (save.ShowDialog(this.GetIWin32Window()) != System.Windows.Forms.DialogResult.Cancel) {
AAnalyzer.LastSavePath = Path.GetDirectoryName(save.FileName);
try {
StreamWriter writer = File.CreateText(save.FileName);
writer.Write(prepareReport());
writer.Close();
saved = true;
} catch(Exception ex) {
TranslatingMessageHandler.SendError("WriteError", ex, save.FileName);
}
}
}
开发者ID:Korn1699,项目名称:MASGAU,代码行数:25,代码来源:ReportWindow.xaml.cs
示例8: btnExport_Click
private void btnExport_Click(object sender, RoutedEventArgs e)
{
if (string.IsNullOrEmpty(txbAPIKey.Text) || string.IsNullOrEmpty(txbEventId.Text))
{
MessageBox.Show("Please enter all the information on the form.", "Export", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
//load data from meetup should be async
IMeetupService service = new MeetupService(new MeetupRepository(txbAPIKey.Text));
IList<RsvpItem> rsvpItems = service.GetRsvpsForEvent(long.Parse(txbEventId.Text));
//export it
var saveFileDialog = new SaveFileDialog
{
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
DefaultExt = "csv",
AddExtension = true,
Filter = @"CSV Files (*.csv)|*.csv"
};
if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
try
{
File.WriteAllText(saveFileDialog.FileName, new RsvpManager().GetAttendees(rsvpItems).ToCsv(true));
MessageBox.Show("Export done.", "Export", MessageBoxButton.OK, MessageBoxImage.Information);
}
catch
{
MessageBox.Show("Export Failed.", "Export", MessageBoxButton.OK, MessageBoxImage.Error);
}
}
}
开发者ID:davidpadbury,项目名称:MeetupManager,代码行数:34,代码来源:Window1.xaml.cs
示例9: OnClick
public override void OnClick()
{
System.Data.IDbConnection resultConnection = CheckApplication.CurrentTask.ResultConnection as System.Data.OleDb.OleDbConnection;
if (resultConnection == null)
{
DevExpress.XtraEditors.XtraMessageBox.Show("��ǰ����״̬�����Ϊ�Ѵ����������������ѱ��Ƴ���");
return;
}
System.Windows.Forms.SaveFileDialog dlgShpFile = new System.Windows.Forms.SaveFileDialog();
dlgShpFile.FileName = Environment.CurrentDirectory + "\\" + CheckApplication.CurrentTask.Name + ".xls";
dlgShpFile.Filter = "SHP �ļ�|*.Shp";
if (dlgShpFile.ShowDialog() != System.Windows.Forms.DialogResult.OK)
return;
string strFile = dlgShpFile.FileName;
string strPath = System.IO.Path.GetDirectoryName(strFile);
string strName = System.IO.Path.GetFileNameWithoutExtension(strFile);
Hy.Check.Task.Task curTask = CheckApplication.CurrentTask;
ErrorExporter exporter = new ErrorExporter();
exporter.BaseWorkspace = curTask.BaseWorkspace;
exporter.ResultConnection = curTask.ResultConnection;
exporter.SchemaID = curTask.SchemaID;
exporter.Topology = curTask.Topology;
exporter.ExportToShp(strPath, strName);
}
开发者ID:hy1314200,项目名称:HyDM,代码行数:27,代码来源:ExportToVCTCommand.cs
示例10: Action
public override bool Action(string action)
{
bool result = base.Action(action);
if (result)
{
if (action == ACTION_EXPORT_ALL || action == ACTION_EXPORT_SELECTED || action == ACTION_EXPORT_ACTIVE)
{
List<Framework.Data.Geocache> gcList = null;
if (action == ACTION_EXPORT_ALL)
{
gcList = (from Framework.Data.Geocache a in Core.Geocaches select a).ToList();
}
else if (action == ACTION_EXPORT_SELECTED)
{
gcList = Utils.DataAccess.GetSelectedGeocaches(Core.Geocaches);
}
else
{
if (Core.ActiveGeocache != null)
{
gcList = new List<Framework.Data.Geocache>();
gcList.Add(Core.ActiveGeocache);
}
}
if (gcList == null || gcList.Count == 0)
{
System.Windows.Forms.MessageBox.Show(Utils.LanguageSupport.Instance.GetTranslation(STR_NOGEOCACHESELECTED), Utils.LanguageSupport.Instance.GetTranslation(STR_ERROR), System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
}
else
{
using (System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog())
{
dlg.FileName = "";
if (Properties.Settings.Default.ZipFile)
{
dlg.Filter = "*.zip|*.zip";
}
else
{
dlg.Filter = "*.gpx|*.gpx";
}
if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
_filename = dlg.FileName;
_gpxGenerator = new Utils.GPXGenerator(Core, gcList, string.IsNullOrEmpty(Properties.Settings.Default.GPXVersionStr) ? Utils.GPXGenerator.V101: Version.Parse(Properties.Settings.Default.GPXVersionStr));
_gpxGenerator.MaxNameLength = Properties.Settings.Default.MaxGeocacheNameLength;
_gpxGenerator.MinStartOfname = Properties.Settings.Default.MinStartOfGeocacheName;
_gpxGenerator.UseNameForGCCode = Properties.Settings.Default.UseNameAndNotCode;
_gpxGenerator.AddAdditionWaypointsToDescription = Properties.Settings.Default.AddWaypointsToDescription;
_gpxGenerator.UseHintsForDescription = Properties.Settings.Default.UseHintsForDescription;
_gpxGenerator.AddFieldnotesToDescription = Properties.Settings.Default.AddFieldnotesToDescription;
_gpxGenerator.ExtraCoordPrefix = Properties.Settings.Default.CorrectedNamePrefix;
PerformExport();
}
}
}
}
}
return result;
}
开发者ID:RH-Code,项目名称:GAPP,代码行数:60,代码来源:GpxExport.cs
示例11: menuitem_Click
void menuitem_Click(object sender, EventArgs e)
{
if (_host.Chats.Length != 0) {
System.Windows.Forms.SaveFileDialog sf = new System.Windows.Forms.SaveFileDialog();
sf.DefaultExt = ".xml";
sf.Filter = "XMLファイル(*.xml)|*.xml";
sf.FileName = "export_" + _host.Id + ".xml";
if (sf.ShowDialog((System.Windows.Forms.IWin32Window)_host.Win32WindowOwner) == System.Windows.Forms.DialogResult.OK) {
string xml = buildNicoXML();
if (xml != null) {
try {
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(sf.FileName)) {
sw.WriteLine(xml);
sw.Close();
}
_host.ShowStatusMessage("エクスポートに成功しました。");
} catch (Exception ex) {
NicoApiSharp.Logger.Default.LogException(ex);
_host.ShowFaitalMessage("エクスポートに失敗しました。詳しい情報はログファイルを参照してください");
}
}
}
}
}
开发者ID:nico-lab,项目名称:niconama-ocv,代码行数:26,代码来源:Exporter.cs
示例12: ExportToXML
/// <summary>
/// 导出用户选择的XML文件
/// </summary>
/// <param name="ds">DataSet</param>
public void ExportToXML(DataSet ds)
{
System.Windows.Forms.SaveFileDialog saveFileDlg = new System.Windows.Forms.SaveFileDialog();
saveFileDlg.DefaultExt = "xml";
saveFileDlg.Filter = "xml文件 (*.xml)|*.xml";
if (saveFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
doExportXML(ds, saveFileDlg.FileName);
}
开发者ID:rew170,项目名称:soomecode,代码行数:12,代码来源:ExcelUtils.cs
示例13: SaveTheme
public static void SaveTheme(this MsDev2013_Theme theme)
{
using (var sfd = new System.Windows.Forms.SaveFileDialog() { Filter = "YAML File|*.yml" })
{
if (sfd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
theme.SaveTheme(sfd.FileName);
}
}
开发者ID:tfwio,项目名称:sd-ext,代码行数:8,代码来源:ThemeGen2.cs
示例14: SaveAsMenuItem_Click
private void SaveAsMenuItem_Click(object sender, RoutedEventArgs e)
{
System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog();
dialog.DefaultExt = ".bvh";
dialog.Filter = "BVHファイル(*.bvh)|*.bvh";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
bvhTo.BVH.Save(dialog.FileName);
}
}
开发者ID:satokoba,项目名称:MMDBVHToSLBVH,代码行数:10,代码来源:Window1.xaml.cs
示例15: btnSaveImg_Click
private void btnSaveImg_Click(object sender, RoutedEventArgs e)
{
var sfd = new System.Windows.Forms.SaveFileDialog
{
Title = "Select where do you want to save the Screenshot",
Filter = "PNG Image (*.png)|*.png"
};
if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
SaveImage(sfd.FileName);
}
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:10,代码来源:HaloScreenshot.xaml.cs
示例16: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.buildButton = new System.Windows.Forms.Button();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.progressLabel = new System.Windows.Forms.Label();
this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
this.SuspendLayout();
//
// buildButton
//
this.buildButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.buildButton.FlatStyle = System.Windows.Forms.FlatStyle.System;
this.buildButton.Location = new System.Drawing.Point(3, 3);
this.buildButton.Name = "buildButton";
this.buildButton.Size = new System.Drawing.Size(86, 24);
this.buildButton.TabIndex = 18;
this.buildButton.Text = "&Build...";
this.buildButton.Click += new System.EventHandler(this.BuildButton_Click);
//
// progressBar
//
this.progressBar.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.progressBar.Location = new System.Drawing.Point(3, 53);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(294, 23);
this.progressBar.TabIndex = 19;
this.progressBar.Visible = false;
//
// progressLabel
//
this.progressLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.progressLabel.AutoEllipsis = true;
this.progressLabel.Location = new System.Drawing.Point(3, 37);
this.progressLabel.Name = "progressLabel";
this.progressLabel.Size = new System.Drawing.Size(294, 13);
this.progressLabel.TabIndex = 20;
this.progressLabel.Text = "Progress message...";
//
// BuildStep
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Transparent;
this.Controls.Add(this.progressLabel);
this.Controls.Add(this.progressBar);
this.Controls.Add(this.buildButton);
this.Name = "BuildStep";
this.Size = new System.Drawing.Size(300, 85);
this.Tag = "Build the application syndication feed. All other steps must be completed before" +
" the Build button will be activated.";
this.ResumeLayout(false);
}
开发者ID:bullshock29,项目名称:Wix3.6Toolset,代码行数:59,代码来源:BuildStep.Designer.cs
示例17: Game1
public Game1()
{
graphics = new GraphicsDeviceManager(this);
Content.RootDirectory = "Content";
saveBox = new System.Windows.Forms.SaveFileDialog();
saveBox.Title = "Save Level As";
saveBox.Filter = "Psychic Ninja Level File | *.xml";
openBox = new System.Windows.Forms.OpenFileDialog();
openBox.Title = "Load Psychic Ninja Level";
openBox.Filter = "Psychic Ninja Level File | *.xml";
}
开发者ID:virusmarathe,项目名称:Portfolio,代码行数:11,代码来源:Game1.cs
示例18: ExportMapBehavior
public void ExportMapBehavior(object sender, TomShane.Neoforce.Controls.EventArgs e)
{
Button btn = (Button)sender;
btn.Focused = false;
System.Windows.Forms.SaveFileDialog exportMapDialog = new System.Windows.Forms.SaveFileDialog();
exportMapDialog.InitialDirectory = Convert.ToString(Environment.SpecialFolder.CommonProgramFilesX86);
exportMapDialog.Filter = "Map files (*.datmap)|*.datmap";
exportMapDialog.FilterIndex = 1;
exportMapDialog.Title = "Export your map";
exportMapDialog.FileOk += new System.ComponentModel.CancelEventHandler(SuccessfullyExportedMap);
exportMapDialog.ShowDialog();
}
开发者ID:Hoodad,项目名称:Editor_TLCB,代码行数:12,代码来源:ToolbarSystem.cs
示例19: ExportButton_Click
private void ExportButton_Click(object sender, RoutedEventArgs e)
{
System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog();
dialog.Filter = "Sql files(*.sql)|*.sql|All Files (*.*)|*.*";
dialog.Title = "Enter name of file to back up data";
if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
string file_name = dialog.FileName;
if (Onion.MySQLHandler.MySQLHelper.BackUp(file_name))
MessageBox.Show("Database exported successfully");
}
}
开发者ID:GrayJumba,项目名称:Onion,代码行数:12,代码来源:ManageDatabaseWindow.xaml.cs
示例20: btnXuat_Click
private void btnXuat_Click(object sender, RoutedEventArgs e)
{
System.Windows.Forms.SaveFileDialog dlg = new System.Windows.Forms.SaveFileDialog();
dlg.InitialDirectory = mTranSit.DuongDanHinh;
dlg.Filter = "Excel Files | *.xlsx";
if (dlg.ShowDialog()==System.Windows.Forms.DialogResult.OK)
{
//ExportImport.ImportExportProcess.Export(dlg.FileName);
//mImportExportProcess.Export(dlg.FileName);
mImportExportProcess.ExportItem(dlg.FileName);
}
}
开发者ID:MisterTobi,项目名称:restaurant-cafe,代码行数:12,代码来源:WindowMenuExport.xaml.cs
注:本文中的System.Windows.Forms.SaveFileDialog类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论