02-15-2023, 07:42 AM (This post was last modified: 02-15-2023, 08:22 AM by Davider.)
Hi,
The following code, I can:
1.Use the hotkey Ctrl+Q to add // to the beginning of the current line
2.Use the hotkey Alt+Q to Replace the text of the current line
But it's not perfect. It flashes during execution. Can it be executed in the background without selecting the line text?
In addition, Can i use Scintilla control built-in language Lexer(Keywords auto coloring, As shown in the picture below)? Can anyone provide an example?
I want to switch different code coloring Lexer schemes by pushing buttons, As shown in the picture below
int cp=SendMessage(sci SCI.SCI_GETCURRENTPOS00) int line=SendMessage(sci SCI.SCI_LINEFROMPOSITION cp 0) int length2=SendMessage(sci SCI.SCI_LINELENGTH line 0) str text.all(length2 2) SendMessage(sci SCI.SCI_GETLINE line text) mes text
TextArea.SetKeywords(0, "class extends implements import interface new case do while else if for in switch throw get set function var try catch finally while with default break continue delete return each const namespace package include use is as instanceof typeof author copy default deprecated eventType example exampleText exception haxe inheritDoc internal link mtasc mxmlc param private return see serial serialData serialField since throws usage version langversion playerversion productversion dynamic private public partial static intrinsic internal native override protected AS3 final super this arguments null Infinity NaN undefined true false abstract as base bool break by byte case catch char checked class const continue decimal default delegate do double descending explicit event extern else enum false finally fixed float for foreach from goto group if implicit in int interface internal into is lock long new null namespace object operator out override orderby params private protected public readonly ref return switch struct sbyte sealed short sizeof stackalloc static string select this throw true try typeof uint ulong unchecked unsafe ushort using var virtual volatile void while where yield");
TextArea.SetKeywords(1, "void Null ArgumentError arguments Array Boolean Class Date DefinitionError Error EvalError Function int Math Namespace Number Object RangeError ReferenceError RegExp SecurityError String SyntaxError TypeError uint XML XMLList Boolean Byte Char DateTime Decimal Double Int16 Int32 Int64 IntPtr SByte Single UInt16 UInt32 UInt64 UIntPtr Void Path File System Windows Forms ScintillaNET");
/// <summary>
/// the background color of the text area
/// </summary>
private const int BACK_COLOR = 0x2A211C;
/// <summary>
/// default text color of the text area
/// </summary>
private const int FORE_COLOR = 0xB7B7B7;
/// <summary>
/// change this to whatever margin you want the line numbers to show in
/// </summary>
private const int NUMBER_MARGIN = 1;
/// <summary>
/// change this to whatever margin you want the bookmarks/breakpoints to show in
/// </summary>
private const int BOOKMARK_MARGIN = 2;
private const int BOOKMARK_MARKER = 2;
/// <summary>
/// change this to whatever margin you want the code folding tree (+/-) to show in
/// </summary>
private const int FOLDING_MARGIN = 3;
/// <summary>
/// set this true to show circular buttons for code folding (the [+] and [-] buttons on the margin)
/// </summary>
private const bool CODEFOLDING_CIRCULAR = true;
private void TextArea_MarginClick(object sender, MarginClickEventArgs e) {
if (e.Margin == BOOKMARK_MARGIN) {
// Do we have a marker for this line?
const uint mask = (1 << BOOKMARK_MARKER);
var line = TextArea.Lines[TextArea.LineFromPosition(e.Position)];
if ((line.MarkerGet() & mask) > 0) {
// Remove existing bookmark
line.MarkerDelete(BOOKMARK_MARKER);
} else {
// Add bookmark
line.MarkerAdd(BOOKMARK_MARKER);
}
}
}
#endregion
}
}