哪位老兄能把MSDN中关于SaveFileDialog的讲解发给我一份,我的MSDN坏了,有急用。
最好全一点,成员函数、变量等等。拜托了。 问题点数:30、回复次数:2Top
1 楼FireBow(狙击手)回复于 2001-07-25 13:02:25 得分 15
SaveFileDialog Class
Encapsulates the Save As common dialog box control that allows the user to specify options for saving a file.
Component
|
+--CommonDialog
|
+--FileDialog
|
+--SaveFileDialog
package com.ms.wfc.ui
public class SaveFileDialog
extends FileDialog
Remarks
The following example sets options for a Save As dialog box, displays the dialog box, and stores the name the user saved the file under in a variable:
private void btnSave_click(Object source, Event e)
{
SaveFileDialog sfd = new SaveFileDialog();
sfd.setDefaultExt("java"); //sets the default extension
sfd.setValidateNames(true); //enables name validation
sfd.setCreatePrompt(true); //prompts the user to create the file if it doesn't exist
sfd.setInitialDir("c:\\program files"); //sets the initial directory
int dlgResult = sfd.showDialog();
if (dlgResult == DialogResult.OK) {
String fname = sfd.getFileName(); //gets the name the file was stored under
MessageBox.show(fname);
}
}
/8----------------------------Methods Description
getCreatePrompt Retrieves a boolean value indicating whether the dialog box prompts the user for permission to create a file if the user specifies a file that does not exist.
getOverwritePrompt Retrieves a boolean value indicating whether the Save As dialog box should display a warning if the user specifies a file name that already exists.
reset Resets all dialog box options to their default values.
setCreatePrompt Sets a boolean value indicating whether the dialog box prompts the user for permission to create a file if the user specifies a file that does not exist.
setOverwritePrompt Sets a boolean value indicating whether the Save As dialog box should display a warning if the user specifies a file name that already exists.
够了吗?就怕你看不懂E 文
Top
2 楼FireBow(狙击手)回复于 2001-07-25 13:05:40 得分 15
SaveFileDialog.getCreatePrompt
Retrieves a boolean value indicating whether the dialog box prompts the user for permission to create a file if the user specifies a file that does not exist.
Syntax
public final boolean getCreatePrompt()
Return Value
Returns true if the dialog box prompts the user before creating a file if the user specifies a file name that does not exist; returns false if the dialog box automatically creates the new file without prompting the user for permission.
See Also setCreatePrompt
/-----------------------------------------------------SaveFileDialog.getOverwritePrompt
Retrieves a boolean value indicating whether the Save As dialog box should display a warning if the user specifies a file name that already exists.
Syntax
public final boolean getOverwritePrompt()
Return Value
Returns true if the dialog box prompts the user before overwriting an existing file if the user specifies a file name that already exists; returns false if the dialog box automatically overwrites the existing file without prompting the user for permission.
Remarks
The warning allows the user to specify whether to overwrite the existing file.
/——————————————————————————————————————
SaveFileDialog.reset
Resets all dialog box options to their default values.
Syntax
public void reset()
Overrides FileDialog.reset
/——————————————————————————————————
SaveFileDialog.setCreatePrompt
Sets a boolean value indicating whether the dialog box prompts the user for permission to create a file if the user specifies a file that does not exist.
Syntax
public final void setCreatePrompt( boolean value )
Parameters
value
Set to true if the dialog box prompts the user before creating a file if the user specifies a file name that does not exist; set to false if the dialog box automatically creates the new file without prompting the user for permission. The default value is false. If the user chooses to create the file, the dialog box closes and the function returns the specified name; otherwise, the dialog box remains open. The validateNames property must also be set to true for the user to be prompted for permission.
Remarks
For a code example using this method, see the SaveFileDialog control topic
/——————————————————————————————————————
SaveFileDialog.setOverwritePrompt
Sets a boolean value indicating whether the Save As dialog box should display a warning if the user specifies a file name that already exists.
Syntax
public final void setOverwritePrompt( boolean value )
Parameters
value
Set to true if the dialog box prompts the user before overwriting an existing file if the user specifies a file name that already exists; set to false if the dialog box automatically overwrites the existing file without prompting the user for permission. The default value is true. If the user chooses to overwrite the file, the dialog box closes; otherwise, the dialog box remains open. The validateNames property must also be set to true for the user to be prompted for permission.
Remarks
The warning allows the user to choose whether to overwrite the existing file
Top




