[]
        
(Showing Draft Content)

C1.Win.C1Editor.C1Editor

C1Editor Class

Represents the C1Editor control.

Namespace: C1.Win.C1Editor
Assembly: C1.Win.C1Editor.4.8.dll
Syntax
[ToolboxBitmap(typeof(C1Editor), "C1Editor.png")]
public class C1Editor : UserControl, IDropTarget, ISynchronizeInvoke, IWin32Window, IBindableComponent, IComponent, IDisposable, IContainerControl, ISupportInitialize, INotifyPropertyChanged
Remarks

The control has a Document property. It is possible to assign an existing document to this property and it will be displayed in the control.

The control and the document are bound. If the document is edited within the control, the underlying XmlDocument changes to match the edited document. If the XmlDocument changes (in code), then the changes appear in the editor.

Examples

This sample shows how to load an XHTML string into the editor and append a stylesheet using functions of XmlDocument.

c1Editor1.LoadXml(xhtml);
XmlElement style = c1Editor1.Document.CreateElement("style");
style.InnerXml = "strong {text-decoration:underline}";
foreach (XmlNode node in c1Editor1.Document.DocumentElement)
{
    if (node.Name == "head")
    {
        node.AppendChild(style);
        break;
    }
}

Constructors

Name Description
C1Editor()

Initializes a new instance of the C1Editor class.

Properties

Name Description
AcceptsTab

Gets or sets a value indicating whether pressing the TAB key in a control types a TAB character in the editor instead of moving the focus to the next control in the tab order.

AllowAdHocTags

Indicates whether the editor turns validation on or off.

AllowDrop

Gets or sets a value indicating whether the editor can accept data that the user drags onto it.

BaseUri

Gets the base Uri of the current document.

BorderStyle

Indicates whether the editor should have a border.

CanCopy

Gets a value indicating whether the copy command is supported on the current selection.

CanCut

Gets a value indicating whether the cut command is supported on the current selection.

CanPaste

Gets a value indicating whether the paste command is supported on the current selection.

CanPasteAsText

Determines whether you can paste information from the Clipboard in text format.

ContextMenuStrip

Overrides the ContextMenuStrip property.

CustomDialogs

Allows user-defined dialog boxes such as Find/Replace, Format, Insert table, and others to be used.

DefaultMinimumSize

Overrides DefaultMinimumSize.

DefaultTitle

Gets or sets a string (followed by a number) used for the 'title' attribute of the loaded document if that attribute is not specified.

Document

Gets or sets the XML document bound to the C1Editor.

EnableComments

Indicates whether the editor turns Comments feature on or off.

Focused

Gets a Boolean value indicating whether the control has input focus.

History

Returns XML document for editing

IsDirty

Gets a Boolean value that indicates whether the document has been modified since it was last saved.

KeyboardShortcutsEnabled

Gets or sets a value indicating whether the editor processes shortcuts for basic editing operations

MaxLength

Gets or sets the maximum number of characters the user can type or paste into the editor control.

Mode

Defines current editor view and behavior.

ReadOnly

Gets or sets a value indicating whether content in the editor is read-only.

RenderEngine

Specifies the IE rendering engine.

SelectedText

Gets the text currently selected in the C1Editor.

Selection

Gets the current selection in the C1Editor.

SelectionLength

Gets or sets the number of selected characters in the C1Editor.

SelectionStart

Gets or sets the index of the first selected character in the C1Editor.

SetFocusAfterLoading

Gets or sets a value indicating whether focus will be set to a control after the document is loaded.

Text

Gets or sets the current text in the editor.

WebBrowser

Returns the ActiveX WebBrowser object for current Mode.

WordWrap

Indicates whether the editor automatically wraps words to the beginning of the next line when necessary in the Source mode.

Xml

Gets or sets the current XML content of the editor.

XmlExtensions

Contains information about custom elements and attributes that extend the standard XHTML DTD.

Methods

Name Description
BeginInit()

Begins the initialization of a C1Editor control that is used on a form or used by another component. The initialization occurs at run time.

BeginTransaction(string)

Begins a transaction.

CanRedo()

Returns a value that indicates whether the most recent undo action can be redone.

CanShowDialog(DialogType)

Returns a Boolean value indicating whether or not the specified dialog can be shown.

CanUndo()

Returns a value that indicates whether the most recent action can be undone.

CommitTransaction()

Commits the started transaction.

Copy()

Copies the current selection to the Clipboard.

CreateRange()

Creates a text range.

CreateRange(C1TextPointer, C1TextPointer)

Creates a range between the specified start and end C1TextPointer.

CreateRange(int, int)

Creates a range that begins with the specified starting character and continues through the specified length of characters.

CreateRange(XmlNode)

Creates a range on the specified XmlNode.

Cut()

Moves the current selection to the Clipboard.

Dispose(bool)

Releases all the resources that the editor owns.

EndInit()

Ends the initialization of a C1Editor that is used on a form or used by another component. The initialization occurs at run time.

FixSource()

Fixes the document in source mode, corrects errors, makes it valid XHTML.

Focus()

Sets input focus to the control.

GetActiveXInstance()

Gets the underlying ActiveX WebBrowser control.

HasOpenTransaction()

Gets a value indicating whether the editor has open transaction.

LoadDesignCSS(Stream)

Loads a design CSS from a given stream.

LoadDesignCSS(string)

Loads a design CSS from a given file. The base URL is inferred from the file location.

LoadPreviewCSS(Stream)

Loads the preview CSS from a given stream. The base URL is not given; it assumes a simple, self-contained CSS. It also assumes the stream is encoded in UTF8.

LoadPreviewCSS(string)

Loads the preview CSS from a given file. Base URL is inferred from the file location.

LoadRtf(Stream, Uri)

Loads the document from the specified stream in RTF format.

The Stream containing the RTF document to load. Path to resolve pictures, video, links, and so on.
LoadRtf(string)

Loads the document from the specified file in RTF format.

LoadXml(Stream, Uri)

Loads the document from the specified stream in XML format.

The Stream containing the XML document to load. Path to resolve pictures, video, links, and so on.
LoadXml(string)

Loads the document from the specified file in XML format.

LoadXml(string, Uri)

Loads the document from an XML string.

OnAfterSave(EventArgs)

Raises AfterSave event.

OnBackColorChanged(EventArgs)
OnBeforeModeChange(BeforeModeChangeEventArgs)

Raises SelectionChanged event.

OnBeforeSave(CancelEventArgs)

Raises BeforeSave event.

OnDocumentChanged(EventArgs)

Raises DocumentChanged event.

OnEnter(EventArgs)

Sends focus to active browser when entering the editor.

OnFontChanged(EventArgs)
OnForeColorChanged(EventArgs)
OnHtmlEvent(HtmlEventEventArgs)

Raises HtmlEvent event.

OnLoad(EventArgs)
OnModeChanged(EventArgs)

Raises the ModeChanged event.

OnSelectionChanged(EventArgs)

Raises SelectionChanged event.

Paste()

Replaces the current selection in the editor with the contents of the Clipboard.

PasteAsText()

Pastes the contents of the Clipboard into the editor using text format.

PasteEmbeddedImages()

Pastes the contents of an image in the Clipboard into the editor. If no image is present, behaves as Paste.

Print()

Prints the current document.

Print(bool)

Prints the current document.

Print(bool, string)

Prints the current document.

PrintPreview()

Shows a print preview dialog.

PrintPreview(string)

Shows a print preview dialog. Uses the specified print template. See more details about print templates at http://msdn.microsoft.com/en-us/library/aa753279(VS.85).aspx

Redo()

Performs Redo action in the current editor mode (design or source).

RollbackTransaction()

Rolls back the transaction.

SaveRtf(Stream)

Saves the document to the specified stream in RTF format.

SaveRtf(string)

Saves the document to the specified file in RTF format.

SaveXml()

Returns the XML content of the document as a string.

SaveXml(Stream)

Saves the document to the specified stream in XML format.

SaveXml(string)

Saves the document to the specified file in XML format.

ScrollIntoView()

Scrolls current document selection into view.

Select(int, int)

Creates a range that begins with the specified starting character and continues through the specified length of characters, and moves selection to the range.

SelectAll()

Selects the entire contents of the editor.

ShowDialog(DialogType)

Shows the specified dialog box.

Undo()

Performs Undo action in the current editor mode (design or source).

ValidateSource()

Validates document in source mode and shows validation errors if found.

WndProc(ref Message)

Overrides WndProc(ref Message).

Events

Name Description
AfterSave

Occurs after the document is saved.

BeforeModeChange

Occurs when the Mode of the Editor is about to change.

BeforeSave

Occurs before the document is saved.

DocumentChanged

Occurs when any change has happened in the document.

HtmlEvent

Occurs when an HTML event occurs in the browser.

ModeChanged

Occurs when the Mode of the Editor is changed.

SelectionChanged

Occurs when the current selection is changed.