本文整理汇总了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类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}
}
}
}
示例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;
}
}
}
示例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);
}
}
}
示例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);
}
}
}
示例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);
}
示例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;
}
示例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("エクスポートに失敗しました。詳しい情報はログファイルを参照してください");
}
}
}
}
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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);
}