Ejemplo n.º 1
0
        /// <summary>
        /// Constructs a ScrollPanelDemo for the specified program.
        /// </summary>
        /// <param name="program"></param>
        public ScrollPanelDemo(MySimpleWPFApplication program)
            : base(program)
        {
            // Create a stack panel for the title and scroll view.
            StackPanel panel = new StackPanel(Orientation.Vertical);

            // Create the text scroll view and set all of its properties.
            _viewer = new TextScrollViewer(Resources.GetString(
                                               Resources.StringResources.ScrollableText),
                                           MySimpleWPFApplication.NinaBFont, Color.Black);
            _viewer.Width = this.Width;
            // Make room for the title bar.
            _viewer.Height              = this.Height - 25;
            _viewer.HScrollHeight       = 10;
            _viewer.VScrollWidth        = 10;
            _viewer.HorizontalAlignment = HorizontalAlignment.Left;
            _viewer.VerticalAlignment   = VerticalAlignment.Top;

            // Create the title text
            Text title = new Text(MySimpleWPFApplication.NinaBFont,
                                  Resources.GetString(Resources.StringResources.ScrollableTextTitle));

            title.ForeColor = Color.White;

            // Add the elements to the stack panel.
            panel.Children.Add(title);
            panel.Children.Add(_viewer);

            // Add the stack panel to this window.
            this.Child = panel;

            // Set the background color.
            this.Background =
                new SolidColorBrush(ColorUtility.ColorFromRGB(64, 64, 255));
        }
        /// <summary>
        /// Constructs a ScrollPanelDemo for the specified program.
        /// </summary>
        /// <param name="program"></param>
        public ScrollPanelDemo(MySimpleWPFApplication program)
            : base(program)
        {
            // Create a stack panel for the title and scroll view.
            StackPanel panel = new StackPanel(Orientation.Vertical);

            // Create the text scroll view and set all of its properties.
            _viewer = new TextScrollViewer(Resources.GetString(
                Resources.StringResources.ScrollableText),
                MySimpleWPFApplication.NinaBFont, Color.Black);
            _viewer.Width = this.Width;
            // Make room for the title bar.
            _viewer.Height = this.Height - 25;
            _viewer.HScrollHeight = 10;
            _viewer.VScrollWidth = 10;
            _viewer.HorizontalAlignment = HorizontalAlignment.Left;
            _viewer.VerticalAlignment = VerticalAlignment.Top;

            // Create the title text
            Text title = new Text(MySimpleWPFApplication.NinaBFont,
                Resources.GetString(Resources.StringResources.ScrollableTextTitle));
            title.ForeColor = Color.White;

            // Add the elements to the stack panel.
            panel.Children.Add(title);
            panel.Children.Add(_viewer);

            // Add the stack panel to this window.
            this.Child = panel;

            // Set the background color.
            this.Background =
                new SolidColorBrush(ColorUtility.ColorFromRGB(64, 64, 255));
        }