using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace UI.Winforms { public partial class DnaEditor : Form { public DnaEditor() { InitializeComponent(); // Add the keywords to the list. // Will just run though a file with these in and add them that way // Or reflect on the DNA module syntaxRichTextBox1.Settings.Keywords.Add("add"); syntaxRichTextBox1.Settings.Keywords.Add("sub"); syntaxRichTextBox1.Settings.Keywords.Add("mult"); syntaxRichTextBox1.Settings.Keywords.Add("div"); syntaxRichTextBox1.Settings.Keywords.Add("sqrt"); syntaxRichTextBox1.Settings.Keywords.Add("max"); syntaxRichTextBox1.Settings.Keywords.Add("min"); syntaxRichTextBox1.Settings.Keywords.Add("swap"); syntaxRichTextBox1.Settings.Keywords.Add("rand"); syntaxRichTextBox1.Settings.Keywords.Add("abs"); syntaxRichTextBox1.Settings.Keywords.Add("sgn"); syntaxRichTextBox1.Settings.Keywords.Add("neg"); // Set the comment identifier. For Lua this is two minus-signs after each other (--). // For C we would set this property to "//". syntaxRichTextBox1.Settings.Comment = "#"; // Set the colors that will be used. syntaxRichTextBox1.Settings.KeywordColor = Color.Blue; syntaxRichTextBox1.Settings.CommentColor = Color.Green; syntaxRichTextBox1.Settings.StringColor = Color.Gray; syntaxRichTextBox1.Settings.IntegerColor = Color.Purple; // Let's not process strings and integers. syntaxRichTextBox1.Settings.EnableStrings = false; syntaxRichTextBox1.Settings.EnableIntegers = true; // Let's make the settings we just set valid by compiling // the keywords to a regular expression. syntaxRichTextBox1.CompileKeywords(); // Load a file and update the syntax highlighting. //syntaxRichTextBox1.LoadFile("../script.lua", RichTextBoxStreamType.PlainText); syntaxRichTextBox1.ProcessAllLines(); } private void OkButton_Click(object sender, EventArgs e) { this.Close(); } private void CloseButton_Click(object sender, EventArgs e) { this.Close(); } } }