Example #1
0
def get_console_block():
    block = TextBlock()
    block.FontSize = 15
    block.Margin = Thickness(0, 0, 0, 0)
    block.TextWrapping = TextWrapping.Wrap
    block.FontFamily = FontFamily("Consolas, Global Monospace")
    return block
Example #2
0
def _get_text_block(text):
    block = TextBlock()
    block.FontSize = 15
    block.FontFamily = FontFamily(
        "Verdana,Tahoma,Geneva,Lucida Grande,Trebuchet MS,Helvetica,Arial,Serif"
    )
    block.Text = text
    return block
Example #3
0
 def get_text(self, text):
     tb = TextBlock()
     tb.Text = text
     tb.Width = self.canvas.ActualWidth
     tb.Height = 40
     tb.FontSize = 30
     tb.Background = SolidColorBrush(Colors.Black)
     tb.Foreground = SolidColorBrush(Colors.White)
     tb.TextAlignment = TextAlignment.Center
     return tb
Example #4
0
 def _create_body(self, message, value, **extra):
     _label = Label()
     textblock = TextBlock()
     textblock.Text = message
     textblock.TextWrapping = TextWrapping.Wrap
     _label.Content = textblock
     _label.Margin = Thickness(10)
     _label.SetValue(Grid.ColumnSpanProperty, 2)
     _label.SetValue(Grid.RowProperty, 0)
     self.Content.AddChild(_label)
     selector = self._create_selector(value, **extra)
     if selector:
         self.Content.AddChild(selector)
         selector.Focus()
Example #5
0
    def _getTextBlock(rss):

        result = TextBlock()
        for item in rss:
            run = Run(item.Title)
            hlink = Hyperlink(run)

            hlink.NavigateUri = Uri(item.Url)
            hlink.Foreground = harriet.Setting.ChatWindowColor.Foreground
            hlink.RequestNavigate += _OnRequestNavigate

            result.Inlines.Add(hlink)
            result.Inlines.Add(LineBreak())
            result.Inlines.Add(LineBreak())

        return result
Example #6
0
    def setUp(self):
        self.new_ctl = Document.CreateElement('foo')
        self.new_ctl.SetAttribute("id", "newctl")
        self.utf8_string = "aBc 西-雅-图的冬天AbC-123"
        # htmlElement tagName casing varies by browser
        if (BrowserInformation.Name == 'Microsoft Internet Explorer'):
            self.tag = "<B>%s</B>"
        else:
            self.tag = "<b>%s</b>"
        self.new_value = self.tag % self.utf8_string
        self.new_ctl.innerHTML = self.new_value
        body = Document.Body
        body.AppendChild(self.new_ctl)

        app.RootVisual = Canvas()
        self.tb = TextBlock()
        app.RootVisual.Children.Add(self.tb)
Example #7
0
 def __init__(self, h):
     self.ctrl = Button()
     self.Initialize(h)
     if h.get('fontsize'): self.SetFontSize(h['fontsize'])
     if h.get('handler'): self.ctrl.Click += h['handler']
     stack = StackPanel()
     stack.Orientation = Orientation.Vertical  #Horizontal
     self.ctrl.Content = stack
     if h.get('image'):
         image = Image()
         image.Source = BitmapImage(
             System.Uri(h['image'], System.UriKind.Relative))
         image.VerticalAlignment = VerticalAlignment.Center
         image.Stretch = Stretch.Fill  #Stretch.None
         if h.get('size'):
             image.Height = float(h['size'])
             image.Width = float(h['size'])
         stack.Children.Add(image)
     if h.get('label'):
         text = TextBlock()
         text.Text = h['label']
         text.TextAlignment = TextAlignment.Center
         stack.Children.Add(text)
Example #8
0
#####################################################################################
#
#  Copyright (c) Microsoft Corporation. All rights reserved.
#
# This source code is subject to terms and conditions of the Apache License, Version 2.0. A
# copy of the license can be found in the License.html file at the root of this distribution. If
# you cannot locate the  Apache License, Version 2.0, please send an email to
# [email protected]. By using this source code in any fashion, you are agreeing to be bound
# by the terms of the Apache License, Version 2.0.
#
# You must not remove this notice, or any other, from this software.
#
#
#####################################################################################
"""
Bare-bones application used to ensure the 'Silverlight3Release' build configuration of
IronPython is OK.
"""

from System.Windows import Application
from System.Windows.Controls import TextBlock

tb = TextBlock()
tb.Text = "Hello World"

Application.Current.RootVisual = tb