private void PerformSearch(object sender, EventArgs e) { var ids = indexer.GetIds(request.Text); results.Controls.Clear(); var y = 0; foreach (var id in ids) { RichTextBox box = new RichTextBox(); box.Text = texts[id]; foreach (var position in indexer.GetPositions(id, request.Text)) { box.Select(position, request.Text.Length); box.SelectionBackColor = Color.LightBlue; } box.ReadOnly = true; box.Size = new Size(results.Width, 50); box.Location = new Point(0, y); y += box.Height; results.Controls.Add(box); } }