Example #1
0
        protected void InitText(string message, ColorContexts colorContext)
        {
            Message = message;

            TW = new MultiLineTextWidget("message", message,
                                         new WidgetStyle(Color.Empty,
                                                         Theme.GetContextForeColor(colorContext),
                                                         Color.Empty));

            TW.Padding = new Padding(16);
            TW.VAlign  = Alignment.Center;
            TW.HAlign  = Alignment.Center;
            this.OnLayout(CTX, CTX.Bounds);

            // Layout the text
            RectangleF bounds = ContentPanel.ClientRectangle;
            SizeF      sz     = TW.PreferredSize(CTX, bounds.Size);

            if (sz.Height > bounds.Height)
            {
                ScrollableContainer container = ContentPanel.AddChild(new ScrollableContainer("scroller"));
                container.ScrollBars = ScrollBars.Vertical;
                container.AutoScroll = true;
                TW.Dock = Docking.Top;
                container.AddChild(TW);
            }
            else
            {
                ContentPanel.AddChild(TW);
            }
        }
        protected void InitText(string message)
        {
            Message = message;

            MultiLineTextWidget text = new MultiLineTextWidget("message", message);

            text.Padding = new Padding(16);
            text.VAlign  = Alignment.Center;
            text.HAlign  = Alignment.Center;

            Controls.OnLayout(this, this.ClientRectangle);

            // Layout the text

            RectangleF bounds = Controls.ClientRectangle;
            SizeF      sz     = text.PreferredSize(this, bounds.Size);

            if (sz.Height > bounds.Height)
            {
                ScrollableContainer container = this.Controls.AddChild(new ScrollableContainer("scroller"));
                container.ScrollBars = ScrollBars.Vertical;
                container.AutoScroll = true;
                text.Dock            = Docking.Top;
                container.AddChild(text);
            }
            else
            {
                this.Controls.AddChild(text);
            }
        }