Type | Description | |||
Start as String | A string expression that defines the start of an expression. The Start parameter is a combination of HTML tags. The HTML tags are used to paint the starting of an expression. The text in the expression is used to define the beginning of an expression. The Start parameter should be a non empty string in order to define an expression. If the first character in the Start parameter is ^, it indicates that the expression should be at the beginning of the line, else it is ignored. For instance, the AddExpression("^<fgcolor=008000>*</fgcolor>", "<fgcolor=008000> </fgcolor>", ""), makes green the lines that starts with *. For instance, AddExpression("^", "<fgcolor=FF0000> ", ":" ), highlights the start of the line until : character is found. | |||
Expression as String | A string expression that defines the HTML tags used to paint the expression. If the parameter is empty the Start HTML tags are used to paint the rest of the expression. The Expression parameter defines the HTML tags used to paint the expression. The text of the Expression is ignored. | |||
End as String | A string expression that defines the end of an expression. The End parameter is a combination of HTML tags that defines the ending string of an expression, and the HTML tags used to paint the end of an expression. If End parameter is Empty the expression ends to the end of line. | |||
MultipleLines as Variant | Optional. A boolean expression that indicates whether the Start expression affects multiple lines or a single line. By default, the MultipleLines parameter is False. | |||
CaseSensitive as Variant | Optional. The CaseSensitive parameter is of KeywordSensitiveEnum type. A long expression that indicates the type of the start and end expressions. The valid values are 0 - exCaseSensitiveKeyword, 1 - exNonCaseSensitiveKeyword and 2 - exReplaceKeyword. By default, the CaseSensitive parameter is 0 (exCaseSensitiveKeyword) |
The AddExpression method adds a new expression to control's expressions collection. The method has effect if the control's EditType property is exSensitive. An expression begins with some text and may end with another text, or none. Use the AddKeyword method to add new keywords to the control. Use the IgnorePrefixInExpression property to define the prefixes being ignored by an expression. Use the MarkColor property to mark ( on the control's vertical scroll bar ) the positions of the expressions in the control's text. Use the FormatNumbers property to specify the format of the numbers in the control.
The list of supported built-in HTML tags is:
The AddExpression adds a new expression only if the text into the Start HTML expression is not empty. For instance if you define an expression like follows: "<b></b>" no expression will be added. Instead if you use "<fgcolor=008000><b>//</b></fgcolor>" it defines the "//" expression.
Here's few samples how to define expressions and their explications:
AddExpression("<b><fgcolor=008000>//</fgcolor></b>", "", ""). The statement defines an expression that starts with "//" and ends at the end of line. So, if in the control's text we have lines that contains "//" the control will use the defined expression to paint the text that starts at "//" to the end of the line. For instance. The "just a text // just another text", becomes "just a text // just another text"
AddExpression("<b><fgcolor=FFFFFF><bgcolor=FF0000>//</bgcolor></fgcolor></b>", "<fgcolor=0000FF><u> </u></fgcolor>", ""). The statement defines an expression that starts with "//" and ends at the end of line. The expression also defines the HTML tags that will be used to paint the expression excluding the starting of it. So, if in the control's text we have lines that contains "//" the control will use the Start HTML expression to paint the "//", and the for the rest of line, the Expression HTML expression will be used.. For instance. The "just a text // just another text", becomes "just a text // just another text"
AddExpression("<b><fgcolor=FFFFFF><bgcolor=800000>/*</bgcolor></fgcolor></b>", "<fgcolor=000080><u> </u></fgcolor>", "<b><fgcolor=FFFFFF><bgcolor=800000>/*</bgcolor></fgcolor></b>"). The statement defines an expression that starts with "/*" and end ends with "*/". So, if in the control's text we have lines that contains "/*" and ends with "*/" the control will use the Start HTML expression to paint the "/*", will use the Expression HTML expression to pain the middle of the expression, and will use the End HTML expression to paint the "*/" . For instance. The "just a text /* just another text */ just another text", becomes "just a text /* just another text */ just another text"
.AddExpression "<fgcolor=008F00>/*</fgcolor>", "<b><fgcolor=007F00> </fgcolor></b>", "<fgcolor=008F00>*/</fgcolor>", True adds multiple lines expression to the context. Useful to define multiple lines comments like /* and */.
.AddExpression "<fgcolor=008000>// <u>TODO</u></fgcolor>", "<b><fgcolor=0090F0> </fgcolor></b>", "". Adds a // TODO expression, that uses multiple HTML tags at the beginning of the expression like follows: '// TODO bla bla '
.AddExpression "<fgcolor=008000>// <u>TODO</u></fgcolor>", "<b><fgcolor=0090F0> </fgcolor></b>", "", , exReplaceKeyword. Adds a // TODO expression, that uses multiple HTML tags at the beginning of the expression like follows: '// TODO bla bla '. For instance, if the user types // Todo, the control automatically replaces it with // TODO
The Start parameter of the AddExpression method defines the name of the expression that should be used in order to delete an expression. Use DeleteExpression method to delete an expression. For instance, if the Start parameter is "<b>START</b>" the name of the expression is "START" and "START" should be used for accessing the expression. The name of the expression is the text of Start parameter after excluding the HTML tags.
Call the Refresh method to reflect the changes in the control. The AddExpression, AddKeyword, DeleteExpression, DeleteKeyword, ClearKeywords and ClearExpressions do not reflect automatically the changes in the control's visible area until Refresh method is called.
The following VB sample adds and a new expression to highlight the text between /* and */:
With Edit1 .AddExpression "<b><fgcolor=008000>/*</fgcolor></b>", "<b><fgcolor=008000> </fgcolor></b>", "<b><fgcolor=008000>*/</fgcolor></b>", True End With
The following C++ sample adds and a new expression to highlight the text between /* and */:
COleVariant vtMissing; vtMissing.vt = VT_ERROR; m_edit.AddExpression("<b><fgcolor=008000>/*</fgcolor></b>", "<b><fgcolor=008000> </fgcolor></b>", "<b><fgcolor=008000>*/</fgcolor></b>", COleVariant( VARIANT_TRUE ), vtMissing );
The following VB.NET sample adds and a new expression to highlight the text between /* and */:
With AxEdit1 .AddExpression("<b><fgcolor=008000>/*</fgcolor></b>", "<b><fgcolor=008000> </fgcolor></b>", "<b><fgcolor=008000>*/</fgcolor></b>", True, Nothing) End With
The following C# sample adds and a new expression to highlight the text between /* and */:
axEdit1.AddExpression("<b><fgcolor=008000>/*</fgcolor></b>", "<b><fgcolor=008000> </fgcolor></b>", "<b><fgcolor=008000>*/</fgcolor></b>", true, null);
The following VFP sample adds and a new expression to highlight the text between /* and */:
With thisform.Edit1 .AddExpression("<b><fgcolor=008000>/*</fgcolor></b>", "<b><fgcolor=008000> </fgcolor></b>", "<b><fgcolor=008000>*/</fgcolor></b>", .t.) EndWith