Class FileEditControl
Represents a control which is used for editing source files.
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Forms.Edit
Assembly: Syncfusion.Edit.Windows.dll
Syntax
public class FileEditControl : StreamEditControl, IKeyBinderContainer, ILongOperationControllerInternal, ILongOperationController, ISupportInitialize
Constructors
FileEditControl()
Initializes a new instance of the FileEditControl class.
Declaration
public FileEditControl()
Properties
ConvertOnLoad
Gets or sets a value indicating whether the file should be converted when loading the control.
Declaration
public bool ConvertOnLoad { get; set; }
Property Value
Type |
---|
System.Boolean |
Remarks
Such file conversion is needed if file contains different new-line symbols or sequences.
DisplayFileName
Gets the display name of the file. The main difference from the FileName property is that Untitled.[ext] will be returned if file name is not set.
Declaration
public string DisplayFileName { get; }
Property Value
Type |
---|
System.String |
FileName
Gets or sets the name of the currently opened file.
Declaration
public string FileName { get; set; }
Property Value
Type |
---|
System.String |
FileOpened
Gets or sets the file stream that is currently opened in EditControl. If null, it means that we are working not with a file stream.
Declaration
public FileStream FileOpened { get; set; }
Property Value
Type |
---|
System.IO.FileStream |
FlushUndoRedoOnSave
Gets or sets a value indicating whether to enable Undo or Redo after save.
Declaration
public bool FlushUndoRedoOnSave { get; set; }
Property Value
Type |
---|
System.Boolean |
PseudoFileName
Gets or sets the file name to be shown in SaveAs dialog.
Declaration
public string PseudoFileName { get; set; }
Property Value
Type |
---|
System.String |
SaveOnClose
Gets or sets a value indicating whether the save prompt dialog should be displayed before EditControl is disposed or not.
Declaration
public bool SaveOnClose { get; set; }
Property Value
Type |
---|
System.Boolean |
SharedFileMode
Gets or sets a value indicating whether the file should be opened in shared mode or not.
Declaration
public bool SharedFileMode { get; set; }
Property Value
Type |
---|
System.Boolean |
Methods
ChangeEncoding(Encoding, Boolean)
Changes encoding of the underlying stream.
Declaration
protected override void ChangeEncoding(Encoding newEncoding, bool bForced)
Parameters
Type | Name | Description |
---|---|---|
System.Text.Encoding | newEncoding | New encoding. |
System.Boolean | bForced | bForced. |
Overrides
CloseStream()
Closes input stream wrapper. Does not close underlying stream.
Declaration
protected override bool CloseStream()
Returns
Type | Description |
---|---|
System.Boolean | True if operation succeeds. |
Overrides
Dispose(Boolean)
Clean up any resources being used.
Declaration
protected override void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | disposing | True to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
LoadFile()
Loads the content of any desired file and its configuration into the EditControl, instead of typing the code in it.
Declaration
public virtual bool LoadFile()
Returns
Type | Description |
---|---|
System.Boolean | True if operation succeeds. |
LoadFile(String)
Loads the content of any desired file and its configuration into the EditControl, instead of typing the code in it.
Declaration
public override bool LoadFile(string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file to load. |
Returns
Type | Description |
---|---|
System.Boolean | True if operation succeeds. |
Overrides
LoadFile(String, Boolean, Boolean)
Load file and configuration for it.
Declaration
protected virtual bool LoadFile(string fileName, bool convert, bool shared)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file to load. |
System.Boolean | convert | Specifies whether file should be corrected on load. |
System.Boolean | shared | Specifies whether file is opened in shared mode, when entire file is loaded into memory. |
Returns
Type | Description |
---|---|
System.Boolean | True if operation succeeds. |
LoadFile(String, Boolean, Boolean, Encoding)
Load file and configuration for it.
Declaration
protected virtual bool LoadFile(string fileName, bool convert, bool shared, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file to load. |
System.Boolean | convert | Specifies whether file should be corrected on load. |
System.Boolean | shared | Specifies whether file is opened in shared mode, when entire file is loaded into memory. |
System.Text.Encoding | encoding | Encoding to use. |
Returns
Type | Description |
---|---|
System.Boolean | True if operation succeeds. |
LoadFile(String, Encoding)
Loads the content of any desired file and its configuration into the EditControl, instead of typing the code in it.
Declaration
public virtual bool LoadFile(string fileName, Encoding encoding)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file to load. |
System.Text.Encoding | encoding | Encoding to use while loading. |
Returns
Type | Description |
---|---|
System.Boolean | True if operation succeeds. |
MenuHandlerOpen(Object, EventArgs)
Handles File->Open context menu item.
Declaration
protected override void MenuHandlerOpen(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Sender. |
System.EventArgs | e | EventArgs. |
Overrides
MenuHandlerSave(Object, EventArgs)
Handles File->Save context menu item.
Declaration
protected override void MenuHandlerSave(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Sender. |
System.EventArgs | e | EventArgs. |
Overrides
MenuHandlerSaveAs(Object, EventArgs)
Handles File->SaveAs context menu item.
Declaration
protected override void MenuHandlerSaveAs(object sender, EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.Object | sender | Sender. |
System.EventArgs | e | EventArgs. |
Overrides
New()
Creates empty stream and makes editor to edit it.
Declaration
protected bool New()
Returns
Type | Description |
---|---|
System.Boolean | True if operation succeeds. |
New(IConfigLanguage)
Creates empty stream and makes editor to edit it.
Declaration
protected bool New(IConfigLanguage lang)
Parameters
Type | Name | Description |
---|---|---|
IConfigLanguage | lang | Language of new stream. |
Returns
Type | Description |
---|---|
System.Boolean | True if operation succeeds. |
NewFile()
Creates new empty file with specified configuration.
Declaration
public virtual bool NewFile()
Returns
Type | Description |
---|---|
System.Boolean | True if file was created, otherwise false. |
NewFile(IConfigLanguage)
Creates new empty file with specified configuration.
Declaration
public virtual bool NewFile(IConfigLanguage lang)
Parameters
Type | Name | Description |
---|---|---|
IConfigLanguage | lang | Language to be used for text coloring. |
Returns
Type | Description |
---|---|
System.Boolean | True if file was created, otherwise false. |
OnConfigurationChanged()
Updates filters in Save and Open Dialog.
Declaration
protected override void OnConfigurationChanged()
Overrides
OnParentChanged(EventArgs)
Adds event handler for parent changed event.
Declaration
protected override void OnParentChanged(EventArgs e)
Parameters
Type | Name | Description |
---|---|---|
System.EventArgs | e | EventArgs. |
Overrides
Redo()
Performs Redo operation that helps to reinsert the last change made in EditControl.
Declaration
public override void Redo()
Overrides
Save()
Saves the text to file loaded in EditControl.
Declaration
public virtual bool Save()
Returns
Type | Description |
---|---|
System.Boolean | True if file was successfully saved. False is returned only if user has cancelled saving somehow. |
SaveAs()
Shows SaveAs dialog and saves data to specified file.
Declaration
public virtual bool SaveAs()
Returns
Type | Description |
---|---|
System.Boolean | True if operation succeeds. |
SaveFile(String, Encoding, String)
Saves content to the specified file.
Declaration
public virtual bool SaveFile(string fileName, Encoding encoding, string lineEndString)
Parameters
Type | Name | Description |
---|---|---|
System.String | fileName | Name of the file to which the text has to be saved. |
System.Text.Encoding | encoding | Encoding that has to be used when saving. Can be null. |
System.String | lineEndString | Line end string. Can be empty. |
Returns
Type | Description |
---|---|
System.Boolean | bool indicating whether saving succeeded. |
SaveModified()
Saves the file only if it was modified and prompts for filename if needed. This is especially useful when the application is about to be closed or a new file is being loaded into the EditControl.
Declaration
public virtual bool SaveModified()
Returns
Type | Description |
---|---|
System.Boolean | False if file was changed but user decided not to save file, otherwise true. |
Undo()
Performs Undo operation that erase the last change made in the document of EditControl.
Declaration
public override void Undo()
Overrides
Events
FileNameChanged
Occurs after the file name has changed.
Declaration
public event EventHandler FileNameChanged
Event Type
Type |
---|
System.EventHandler |
SaveFileWithDataLoss
Occurs when user tries to save file with data loosing.
Declaration
public event SaveWithDataLosingEventHandler SaveFileWithDataLoss
Event Type
Type |
---|
SaveWithDataLosingEventHandler |
StreamClose
Occurs when underlying stream is about to close and user should decide if he want to save the changes in file.
Declaration
public event StreamCloseEventHandler StreamClose
Event Type
Type |
---|
StreamCloseEventHandler |