/// <summary> /// 过滤字符颜色 /// </summary> /// <param name="filter"></param> private void FilterTextCore(string filter) { if (m_Textpresenter == null) { return; } if (string.IsNullOrEmpty(NormalText)) { return; } if (string.IsNullOrWhiteSpace(filter)) { return; } m_Textpresenter.Inlines.Clear(); char[] chars = NormalText.ToCharArray(); foreach (char c in chars) { Run runTxt = new Run(); runTxt.Text = c.ToString(); if (filter.Contains(c)) //关键字 { runTxt.Foreground = FilterBrush; runTxt.Tag = TAG_FILTERTEXT; } else //正常显示的字符 { runTxt.Foreground = NormalBrush; runTxt.Tag = TAG_NORMALTEXT; } m_Textpresenter.Inlines.Add(runTxt); } }
public FeatDialog(Context context, Feat editFeat) : base(context) { feat = (Feat)editFeat.Clone(); RequestWindowFeature((int)WindowFeatures.NoTitle); SetContentView(Resource.Layout.FeatDialog); SetCanceledOnTouchOutside(true); OKButton.Click += (sender, e) => { Dismiss(); FeatComplete?.Invoke(this, feat); }; CancelButton.Click += (sender, e) => { Dismiss(); }; NameText.AttachEditTextString(feat, "Name"); TypesButton.AttachButtonStringList(feat, "Type", new List <string>(Feat.FeatTypes)); PrerequisitesText.AttachEditTextString(feat, "Prerequistites"); BenefitText.AttachEditTextString(feat, "Benefit"); NormalText.AttachEditTextString(feat, "Normal"); SpecialText.AttachEditTextString(feat, "Special"); feat.PropertyChanged += Feat_PropertyChanged; EnableOK(); }
private void ToText_Click(object sender, EventArgs e) { NormalText.ReadOnly = true; Mors_Code.ReadOnly = false; ToMorse.Enabled = true; ToText.Enabled = false; NormalText.Clear(); Mors_Code.Clear(); }
private void AnalyzeRichText(NormalText txt) { m_TextBuilder.Append(txt.Text); }