void FindPrev() { if (MatchSpots.Count == 0) { return; } if (CurrentSpot == 0) { CurrentSpot = MatchSpots.Count - 1; } else { CurrentSpot--; } if (IsInBinaryMode) { MainRichText.Select(MatchSpots[CurrentSpot], Keyword.Length); MainRichText.ScrollToCaret(); } else { MainText.Select(MatchSpots[CurrentSpot], Keyword.Length); MainText.ScrollToCaret(); } }
void find() { reset_values(); keyword = searchbox.Text; if (keyword.Length == 0) { return; } bool loop = true; int start_index = 0; while (loop) { loop = false; int match_spot = MainText.Text.IndexOf(keyword, start_index, StringComparison.CurrentCultureIgnoreCase); if (match_spot >= 0) { match_spots.Add(match_spot); if ((match_spot + keyword.Length) < MainText.Text.Length) { start_index = match_spot + 1; loop = true; } } } matches.Text = match_spots.Count.ToString(); if (match_spots.Count > 0) { MainText.Select(match_spots[0], keyword.Length); MainText.ScrollToCaret(); } }
public AlertForm(string mainText, int size = 10) { InitializeComponent(); buttonOk.BringToFront(); MainText.SelectionFont = new Font("Tahoma", size, FontStyle.Regular); MainText.AppendText(mainText + "\r\n"); MainText.ScrollToCaret(); MainText.SelectAll(); MainText.SelectionAlignment = HorizontalAlignment.Center; }
void Find() { ResetValues(); Keyword = SearchBox.Text; if (IsInBinaryMode) { TextToSearch = MainRichText.Text; } else { TextToSearch = MainText.Text; } if (Keyword.Length == 0) { return; } bool loop = true; int StartIndex = 0; while (loop) { loop = false; int match_spot = TextToSearch.IndexOf(Keyword, StartIndex, ComparisonType); if (match_spot >= 0) { MatchSpots.Add(match_spot); if ((match_spot + Keyword.Length) < TextToSearch.Length) { StartIndex = match_spot + 1; loop = true; } } } MatchCountLabel.Text = MatchSpots.Count.ToString(); if (MatchSpots.Count > 0) { if (IsInBinaryMode) { MainRichText.Select(MatchSpots[0], Keyword.Length); MainRichText.ScrollToCaret(); } else { MainText.Select(MatchSpots[0], Keyword.Length); MainText.ScrollToCaret(); } } }
void find_prev() { if (match_spots.Count == 0) { return; } if (current_spot == 0) { current_spot = match_spots.Count - 1; } else { current_spot--; } MainText.Select(match_spots[current_spot], keyword.Length); MainText.ScrollToCaret(); }
void find_next() { if (match_spots.Count == 0) { return; } if (current_spot == (match_spots.Count - 1)) { current_spot = 0; } else { current_spot++; } MainText.Select(match_spots[current_spot], keyword.Length); MainText.ScrollToCaret(); }
public EventDisplayForm(ObjectEvent objectEvent) { InitializeComponent(); _actionSelectionFlag = false; TopMost = true; ShowInTaskbar = false; _objectEvent = objectEvent; MainText.SelectionFont = new Font("Tahoma", _objectEvent._sizeFont, FontStyle.Regular); MainText.AppendText(_objectEvent._eventText + "\r\n"); MainText.ScrollToCaret(); MainText.SelectAll(); MainText.SelectionAlignment = HorizontalAlignment.Center; //MainText.Text = _objectEvent._eventText; for (int index = 0; index < _objectEvent._outcomeOptions.Count; index++) { AddEvents(_objectEvent._outcomeOptions[index], index); } }