private void ToolFELintForm_Load(object sender, EventArgs e) { this.X_SUCCESSMESSAGE.BackColor = OptionForm.Color_Keyword_BackColor(); this.X_SUCCESSMESSAGE.ForeColor = OptionForm.Color_Keyword_ForeColor(); this.X_ERRORMESSAGE.BackColor = OptionForm.Color_Error_BackColor(); this.X_ERRORMESSAGE.ForeColor = OptionForm.Color_Error_ForeColor(); }
void UpdateCenterMark() { for (int oldindex = 0; oldindex < MapController.Controls.Count; oldindex++) { Object o = MapController.Controls[oldindex]; if (o is NumericUpDown) { ((NumericUpDown)o).BackColor = OptionForm.Color_Input_BackColor(); ((NumericUpDown)o).ForeColor = OptionForm.Color_Input_ForeColor(); } } CenterX = (int)this.B2.Value; CenterY = (int)this.B3.Value; int newindex = (CenterX + (CenterY * BoxWidth)); if (newindex < MapController.Controls.Count) { Object o = MapController.Controls[newindex]; if (o is NumericUpDown) { ((NumericUpDown)o).BackColor = OptionForm.Color_Keyword_BackColor(); ((NumericUpDown)o).ForeColor = OptionForm.Color_Keyword_ForeColor(); } } }
public void SimpleKeywordHighLight(RichTextBoxEx target) { target.LockWindowUpdate(); Color keywordBackColor = OptionForm.Color_Keyword_BackColor(); Color keywordForeColor = OptionForm.Color_Keyword_ForeColor(); Color commentBackColor = OptionForm.Color_Input_BackColor(); Color commentForeColor = OptionForm.Color_Comment_ForeColor(); string[] keywords = new string[] { "LSL", "LSR", "ASR", "ADD", "SUB", "MOV", "CMP", "AND", "EOR", "ADC", "SBC", "ROR", "TST", "NEG", "CMP", "CMN", "ORR", "BIC", "MVN", "BX", "LDR", "LDRH", "LDRB", "STR", "STRH", "STRB", "LDSB", "LDSH", "PUSH", "POP", "STMIA", "LDMIA", "BEQ", "BNE", "BCS", "BCC", "BMI", "BPL", "BVS", "BVC", "BHI", "BLS", "BGE", "BLT", "BGT", "BLE", "SWI", "B", "BL", ".THUMB", ".ORG", ".EQU", ".LTORG" }; //ハイライトを解除. target.SelectionStart = 0; target.SelectionLength = target.TextLength; target.SelectionColor = OptionForm.Color_Input_ForeColor(); target.SelectionBackColor = OptionForm.Color_Input_BackColor(); //改行コードが違うので、必ず取得しなおす string text = target.Text; int length = text.Length; for (int i = 0; i < length;) { if (U.Wordrap(text[i])) { i++; continue; } int start = i; for (i = i + 1; i < length; i++) { if (U.Wordrap(text[i])) { break; } } string token = text.Substring(start, i - start); if (token.IndexOf('@') == 0) {//コメント int term = text.IndexOf("\n", i); if (term > 0) { i = term; } target.SelectionStart = start; target.SelectionLength = i - start; target.SelectionColor = commentForeColor; target.SelectionBackColor = commentBackColor; continue; } token = token.ToUpper(); foreach (string k in keywords) { if (token == k) {//キーワード target.SelectionStart = start; target.SelectionLength = i - start; target.SelectionColor = keywordForeColor; target.SelectionBackColor = keywordBackColor; break; } } } target.UnLockWindowUpdate(); }