Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        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);
            }
        }
Ejemplo n.º 3
0
 private void Paste()
 {
     Text_Field.Paste();
 }
Ejemplo n.º 4
0
 private void Cut()
 {
     Text_Field.Cut();
 }
Ejemplo n.º 5
0
 private void Copy()
 {
     Text_Field.Copy();
 }
Ejemplo n.º 6
0
 private void Redo()
 {
     Text_Field.Redo();
 }
Ejemplo n.º 7
0
 // begin: implementation of the main functions
 private void Undo()
 {
     Text_Field.Undo();
 }