static void Main(string[] args) { Component window = new Panel("Главная страница (панель)"); Component header = new Panel("Хэдер (панель)"); Component headerText = new Text_Field("Поле ввода в хэдере"); Component headerBtn = new Button("Кнопка в хэдере"); header.Add(headerText); header.Add(headerBtn); window.Add(header); Component footer = new Panel("Футер (панель)"); Component footerText = new Text_Field("Текст в футере"); Component footerBtn = new Button("Кнопка в футере"); footer.Add(footerText); footer.Add(footerBtn); footer.Remove(footerText); window.Add(footer); window.Print(); }
private void HighlightWordInRichTextBox(String word) { TextRange text = new TextRange(Text_Field.Document.ContentStart, Text_Field.Document.ContentEnd); TextPointer current = text.Start.GetInsertionPosition(LogicalDirection.Forward); while (current != null) { string textInRun = current.GetTextInRun(LogicalDirection.Forward); if (!string.IsNullOrWhiteSpace(textInRun)) { int index = textInRun.IndexOf(word); if (index != -1) { TextPointer selectionStart = current.GetPositionAtOffset(index, LogicalDirection.Forward); TextPointer selectionEnd = selectionStart.GetPositionAtOffset(word.Length, LogicalDirection.Forward); TextRange selection = new TextRange(selectionStart, selectionEnd); selection.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold); Text_Field.Selection.Select(selection.Start, selection.End); Text_Field.Focus(); } } current = current.GetNextContextPosition(LogicalDirection.Forward); } }
private void Paste() { Text_Field.Paste(); }
private void Cut() { Text_Field.Cut(); }
private void Copy() { Text_Field.Copy(); }
private void Redo() { Text_Field.Redo(); }
// begin: implementation of the main functions private void Undo() { Text_Field.Undo(); }