コード例 #1
0
        /// <summary>
        /// Constructs a TextScrollViewer using the specified text, font, and color.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="font"></param>
        /// <param name="color"></param>
        public TextScrollViewer(string text, Font font, Color color)
        {
            // Create the ScrollViewer object.
            _viewer = new ScrollViewer();

            // Create the ScrollText object using the parameters passed into the
            // constructor and then set other important member values.
            ScrollText = new ScrollerText(text, font, color);
            ScrollText.HorizontalAlignment = HorizontalAlignment.Left;
            ScrollText.VerticalAlignment   = VerticalAlignment.Top;

            // Set the child of the viewer to be the ScrollText object.
            this._viewer.Child = ScrollText;

            // Hard code a line with and height based on the character 'A'.
            _viewer.LineWidth  = font.CharWidth('A');
            _viewer.LineHeight = font.Height;

            // Set the child of our class to be the ScrollViewer object.
            this.Children.Add(_viewer);
        }
コード例 #2
0
        /// <summary>
        /// Constructs a TextScrollViewer using the specified text, font, and color.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="font"></param>
        /// <param name="color"></param>
        public TextScrollViewer(string text, Font font, Color color)
        {
            // Create the ScrollViewer object.
            _viewer = new ScrollViewer();

            // Create the ScrollText object using the parameters passed into the 
            // constructor and then set other important member values.
            ScrollText = new ScrollerText(text, font, color);
            ScrollText.HorizontalAlignment = HorizontalAlignment.Left;
            ScrollText.VerticalAlignment = VerticalAlignment.Top;

            // Set the child of the viewer to be the ScrollText object.
            this._viewer.Child = ScrollText;

            // Hard code a line with and height based on the character 'A'.
            _viewer.LineWidth = font.CharWidth('A');
            _viewer.LineHeight = font.Height;

            // Set the child of our class to be the ScrollViewer object.
            this.Children.Add(_viewer);
        }